This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 181432 - Error message display for APs sometimes missing
Summary: Error message display for APs sometimes missing
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks: 111293
  Show dependency tree
 
Reported: 2010-03-02 08:37 UTC by Jesse Glick
Modified: 2010-03-03 22:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2010-03-02 08:37:38 UTC
According to bug #111293, the editor is supposed to display error messages from annotation processors run according to AnnotationProcessingQuery and PROCESSOR_PATH. This does not seem to work reliably. In some cases it does:


diff --git a/hibernate/src/org/netbeans/modules/hibernate/reveng/model/package-info.java b/hibernate/src/org/netbeans/modules/hibernate/reveng/model/package-info.java
--- a/hibernate/src/org/netbeans/modules/hibernate/reveng/model/package-info.java
+++ b/hibernate/src/org/netbeans/modules/hibernate/reveng/model/package-info.java
@@ -38,7 +38,7 @@
  */
 
 @Schema2Beans(
-    schema="../../resources/hibernate-reverse-engineering-3.0.dtd",
+    schema="../../resources/hibernate-reverse-engineering-3.1.dtd",
     schemaType=SchemaType.DTD,
     mddFile="../../resources/hibernate-reverse-engineering-3.0.mdd",
     outputType=OutputType.TRADITIONAL_BASEBEAN,


You get an error badge on @Schema2Beans "Failed to process" and a full stack trace at the top of the file (this is just how this AP reports this error). OK.

However, for


diff --git a/project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java b/project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java
--- a/project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java
+++ b/project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java
@@ -97,7 +97,7 @@
  * projects by delegating some functionality to registered Ant project types.
  * @author Jesse Glick
  */
-@ServiceProvider(service=ProjectFactory.class, position=100)
+@ServiceProvider(service=Runnable.class, position=100)
 public final class AntBasedProjectFactorySingleton implements ProjectFactory2 {
     
     public static final String PROJECT_XML_PATH = "nbproject/project.xml"; // NOI18N
 

no error badge is shown at all (on the editor tab or anywhere in the project's node), despite the errors that an Ant build would show:

project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java:100: org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton is not assignable to java.lang.Runnable
@ServiceProvider(service=Runnable.class, position=100)
^
Comment 1 Jesse Glick 2010-03-02 08:42:00 UTC
BTW a Rhino shell (jrunscriptin.kenai.com) confirms that queries are working sanely:

f = org.openide.filesystems.FileUtil.toFileObject(new java.io.File(".../project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java"))
=> MasterFileObject[.../project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java@188d337:7334c9,valid=true]

apq = org.netbeans.api.java.queries.AnnotationProcessingQuery.getAnnotationProcessingOptions(f)
=> org.netbeans.modules.apisupport.project.queries.AnnotationProcessingQueryImpl$ResultImpl@7b94b8

// after #181419:
apq.sourceOutputDirectory()
=> file:.../project.ant/build/classes-generated/

org.netbeans.api.java.classpath.ClassPath.getClassPath(f, org.netbeans.api.java.classpath.JavaClassPathConstants.PROCESSOR_PATH)
=> .../nbbuild/netbeans/platform/modules/org-netbeans-api-progress.jar:.../nbbuild/netbeans/platform/lib/org-openide-util.jar:.../nbbuild/netbeans/ide/modules/org-netbeans-modules-projectapi.jar:.../nbbuild/netbeans/ide/modules/org-netbeans-modules-project-libraries.jar:.../nbbuild/netbeans/platform/modules/org-openide-awt.jar:.../nbbuild/netbeans/platform/modules/org-openide-dialogs.jar:.../nbbuild/netbeans/platform/modules/org-openide-explorer.jar:.../nbbuild/netbeans/platform/modules/org-openide-loaders.jar:.../nbbuild/netbeans/platform/modules/org-openide-actions.jar:.../nbbuild/netbeans/ide/modules/org-netbeans-modules-projectuiapi.jar:.../nbbuild/netbeans/platform/core/org-openide-filesystems.jar:.../nbbuild/netbeans/platform/modules/org-netbeans-swing-outline.jar:.../nbbuild/netbeans/platform/lib/org-openide-util-lookup.jar:.../nbbuild/netbeans/platform/modules/org-netbeans-swing-tabcontrol.jar:.../nbbuild/netbeans/platform/modules/org-netbeans-modules-editor-mimelookup.jar:.../nbbuild/netbeans/platform/modules/org-netbeans-modules-queries.jar:.../nbbuild/netbeans/platform/modules/org-openide-text.jar:.../nbbuild/netbeans/platform/modules/org-openide-nodes.jar:.../nbbuild/netbeans/platform/lib/org-openide-modules.jar:.../nbbuild/netbeans/platform/modules/org-openide-windows.jar:.../nbbuild/netbeans/ide/modules/org-netbeans-modules-xml-catalog.jar:.../nbbuild/netbeans/ide/modules/org-netbeans-api-xml.jar:.../nbbuild/netbeans/ide/modules/org-apache-xml-resolver.jar:.../o.apache.xml.resolver/external/resolver-1.2.jar:.../nbbuild/netbeans/ide/modules/ext/resolver-1.2.jar:.../project.ant/build/classes
Comment 2 Jan Lahoda 2010-03-02 12:12:01 UTC
APTUtils tries to use a few processors loaded by the system classloader, but these are not instances of Processor from "our" javac (the Processor from "our" javac is loaded by libs.javacapi classloader, not by the system classloader). I prevented that:
http://hg.netbeans.org/jet-main/rev/8b7d75efe4aa
Comment 3 Jesse Glick 2010-03-02 12:48:15 UTC
(In reply to comment #2)
> http://hg.netbeans.org/jet-main/rev/8b7d75efe4aa

Possibly easier fix (untested):

ClassLoader cl = new URLClassLoader(urls.toArray(new URL[0]), ClassLoader.getSystemClassLoader().getParent());
Comment 4 Quality Engineering 2010-03-03 22:12:07 UTC
Integrated into 'main-golden', will be available in build *201003040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8b7d75efe4aa
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #181432: prevent using/loading NetBeans classes from the system ClassLoader.