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 101094 - Difference between handling @Deprecated and @Deprecated()
Summary: Difference between handling @Deprecated and @Deprecated()
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-16 06:38 UTC by Martin Adamek
Modified: 2007-09-26 09:14 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 Martin Adamek 2007-04-16 06:38:23 UTC
Failing test case with this failure: expected same:<DECLARED> was not:<ERROR>
If you add parenthesis after @Deprecated annotation, it works fine.

    public void testAnnotation() throws IOException {
        FileObject fileObject = TestUtilities.copyStringToFileObject(srcFO,
"foo/Bar.java",
                "package foo;" +
                "@Deprecated" +
                "public class Bar {" +
                "}");
        JavaSource javaSource = JavaSource.forFileObject(fileObject);
        javaSource.runUserActionTask(new CancellableTask<CompilationController>() {
            public void run(CompilationController controller) throws IOException {
                controller.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
                TypeElement typeElement =
controller.getElements().getTypeElement("foo.Bar");
                AnnotationMirror annotationMirror =
typeElement.getAnnotationMirrors().get(0);
                DeclaredType declaredType = annotationMirror.getAnnotationType();
                assertSame(TypeKind.DECLARED, declaredType.getKind());
            }
            public void cancel() {}
        }, true);
    }
Comment 1 Martin Adamek 2007-04-16 06:41:30 UTC
I am able to reproduce it also on field annotation.
Comment 2 Jan Lahoda 2007-04-16 09:20:04 UTC
Please note that the code in the example is:
package foo;@Deprecatedpublic class Bar {}
so the annotation is "@Deprecatedpublic", which is correctly marked as an error.
Please reopen if the problem is somewhere else.
Comment 3 Martin Adamek 2007-04-16 10:10:23 UTC
Oops, sorry about that :-)
Comment 4 Quality Engineering 2007-09-20 12:34:06 UTC
Reorganization of java component