Index: src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScanner.java =================================================================== --- src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScanner.java (revision 43965) +++ src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementDeltaScanner.java (working copy) @@ -106,7 +106,8 @@ // compilationUnitAST is null when the given compilation unit'w // working copy is being commited (ie, Java Editor is being closed // for the given compilation unit, etc.) - if (compilationUnit.isWorkingCopy() && compilationUnitAST != null) { + if (compilationUnit.exists() // see https://issues.jboss.org/browse/JBIDE-12760: compilationUnit may not exist + && compilationUnit.isWorkingCopy() && compilationUnitAST != null) { // Looking for changes in the method signatures (return type, // param types and param annotations). Other changes in methods // (renaming, adding/removing params) result in add+remove Index: src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java =================================================================== --- src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java (revision 43965) +++ src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedBuildJob.java (working copy) @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.core.runtime.jobs.Job; @@ -38,6 +39,10 @@ Logger.debug("Initiating an incremental JAX-RS Metamodel build after " + event); //$NON-NLS-1$ } + public void execute() { + run(new NullProgressMonitor()); + } + @Override protected IStatus run(final IProgressMonitor progressMonitor) { try { Index: src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java =================================================================== --- src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java (revision 43965) +++ src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedListener.java (working copy) @@ -18,7 +18,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.IElementChangedListener; import org.eclipse.jdt.core.IJavaElement; @@ -46,9 +45,11 @@ try { if (isApplicable(event.getDelta())) { logDelta(event.getDelta(), event.getType()); - Job job = new JavaElementChangedBuildJob(event); - job.setRule(MutexJobSchedulingRule.getInstance()); - job.schedule(); + JavaElementChangedBuildJob job = new JavaElementChangedBuildJob(event); + job.execute(); // not using this class as a job, just calling the execute() method for immediate execution. + /*job.setRule(MutexJobSchedulingRule.getInstance()); + job.schedule();*/ + //job.join(); } } catch (CoreException e) { Logger.error("Failed to process Java Element change", e); Index: src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java =================================================================== --- src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java (revision 43965) +++ src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java (working copy) @@ -142,11 +142,14 @@ * the AST associated to the java type * @param metamodel * the current metamodel, in which the JAX-RS Resource should be added - * @return the created resource + * @return the created resource, or null if the java type did not exist. * @throws CoreException */ public JaxrsResource createResource(IType javaType, CompilationUnit ast, JaxrsMetamodel metamodel) throws CoreException { + if(!javaType.exists()) { + return null; + } // create the resource: final JaxrsResource resource = internalCreateResource(javaType, ast, metamodel); // find the resource methods, subresource methods and subresource @@ -207,7 +210,9 @@ */ public JaxrsResourceMethod createResourceMethod(IMethod method, CompilationUnit ast, JaxrsMetamodel metamodel) throws CoreException { - + if(!method.exists()) { + return null; + } final IType parentType = (IType) method.getParent(); JaxrsResource parentResource = (JaxrsResource) metamodel.getElement(parentType); if (parentResource == null) { @@ -272,6 +277,9 @@ */ public JaxrsHttpMethod createHttpMethod(final IType javaType, final CompilationUnit ast, final JaxrsMetamodel metamodel) throws CoreException { + if(!javaType.exists()) { + return null; + } Map annotations = JdtUtils.resolveAnnotations(javaType, ast, HTTP_METHOD.qualifiedName, TARGET.qualifiedName, RETENTION.qualifiedName); if (annotations == null || annotations.isEmpty()) { return null; @@ -312,6 +320,9 @@ */ public JaxrsJavaApplication createApplication(final IType javaType, final CompilationUnit ast, final JaxrsMetamodel metamodel) throws CoreException { + if(!javaType.exists()) { + return null; + } Annotation applicationPathAnnotation = JdtUtils.resolveAnnotation(javaType, ast, APPLICATION_PATH.qualifiedName); return createApplication(javaType, applicationPathAnnotation, metamodel); } @@ -349,6 +360,9 @@ */ private JaxrsJavaApplication createApplication(final IType applicationType, final Annotation appPathAnnotation, final JaxrsMetamodel metamodel) throws CoreException { + if(!applicationType.exists()) { + return null; + } final IType applicationSupertype = JdtUtils.resolveType(EnumJaxrsClassname.APPLICATION.qualifiedName, applicationType.getJavaProject(), new NullProgressMonitor()); final boolean isApplicationSubclass = JdtUtils.isTypeOrSuperType(applicationSupertype, applicationType); if(isApplicationSubclass || appPathAnnotation != null) { @@ -376,6 +390,9 @@ public JaxrsResourceField createField(IField javaField, CompilationUnit ast, JaxrsMetamodel metamodel) throws JavaModelException { + if(!javaField.exists()) { + return null; + } final IType parentType = (IType) javaField.getParent(); IJaxrsElement parentResource = metamodel.getElement(parentType); if (parentResource == null) { @@ -423,7 +440,9 @@ * @return a representation of the given provider or null in case of invalid type (ie, not a valid JAX-RS Provider) */ public JaxrsProvider createProvider(final IType javaType, final CompilationUnit ast, final JaxrsMetamodel metamodel, final IProgressMonitor progressMonitor ) throws CoreException { - + if(!javaType.exists()) { + return null; + } final Map annotations = JdtUtils.resolveAnnotations(javaType, ast, PROVIDER.qualifiedName, CONSUMES.qualifiedName, PRODUCES.qualifiedName); // assert that given java type is not abstract