Community
Participate
Working Groups
This is similar to bug 322789 but still active: I have a test case where I pass three compilation units to the compiler: p1/X.java: a class with an inner class "Inner" p1/package-info.java: marks this package as @Deprecated p2/C.java: should see X and everything inside as deprecated I can toggle success/failure of this testcase by changing the order of compilation units: passing package-info before X works, the order listed above does not work, i.e., deprecation is not reported. Could this be an artifact of the InMemoryNameEnvironment used by the tests? Otherwise I'd consider checking type deprecation later in the process, if possible. The relevant call chain is the same as in bug 322789 comment 17.
Created attachment 201338 [details] Testcase Here's the failing test case.
Created attachment 201340 [details] Same test plus proposed fix This looks sweet: simply deleting two lines seems to solve the issue: ClassScope.checkAndSetModifiers() should not call isViewedAsDeprecated() for member types, because this call originating from Compiler.beginToCompile() is way too early for requesting another type (here package-info.java). This call appears to be unnecessary, too: the same effect is also achieved later when ASTNode.isTypeUseDeprecated() calls refType.initializeDeprecatedAnnotationTagBits() The other calls inside ClassScope.checkAndSetModifiers() are OK because they only happen later, like during resolve. I'm currently running test against the patch.
Created attachment 201432 [details] Same patch with copyright updated All compiler and model tests passed with this patch.
Released in HEAD for 3.8M2.
+1 for this fix in case we want to also release it for 3.7.1 (in order to fix the issue reported in bug 348024).
*** Bug 355552 has been marked as a duplicate of this bug. ***
(In reply to comment #5) > +1 for this fix in case we want to also release it for 3.7.1 (in order to fix > the issue reported in bug 348024). +1 for 3.7.1, Jay, please take this forward for 3.7.1
Released in 3.7.x maintenance branch for 3.7.1 RC2. Jay, please include fix for RC2 -- Thanks.
Verified for 3.7.1 RC2 with build M20110824-0800.
Verified for 3.8M2.