Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 207685 Details for
Bug 186342
[compiler][null] Using annotations for null checking
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
fix and test for NPE
fix-for-NPE.patch (text/plain), 3.00 KB, created by
Ayushman Jain
on 2011-11-29 14:49:02 EST
(
hide
)
Description:
fix and test for NPE
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-11-29 14:49:02 EST
Size:
3.00 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java >index 279b70c..19b79ef 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java >@@ -52,7 +52,7 @@ > // Static initializer to specify tests subset using TESTS_* static variables > // All specified tests which do not belong to the class are skipped... > static { >-// TESTS_NAMES = new String[] { "test_illegal_annotation_00" }; >+// TESTS_NAMES = new String[] { "test_illegal_annotation_007" }; > // TESTS_NUMBERS = new int[] { 561 }; > // TESTS_RANGE = new int[] { 1, 2049 }; > } >@@ -1812,6 +1812,42 @@ > "----------\n"); > } > >+// a configured annotation type does not exist >+// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=186342#c133 >+public void test_illegal_annotation_007() { >+ Map customOptions = getCompilerOptions(); >+ runNegativeTestWithLibs( >+ new String[] { >+ "p/Test.java", >+ "package p;\n" + >+ "import org.eclipse.jdt.annotation.*;\n" + >+ "interface TestInt{\n" + >+ " @NonNull Object foo();\n" + >+ "}\n" + >+ "\n" + >+ "public class Test { \n" + >+ " void bar() {" + >+ " new TestInt() {\n" + >+ " @org public Object foo() {\n" + >+ " }\n" + >+ " };\n" + >+ " }\n" + >+ "}" >+ }, >+ customOptions, >+ "----------\n" + >+ "1. ERROR in p\\Test.java (at line 9)\n" + >+ " @org public Object foo() {\n" + >+ " ^^^\n" + >+ "org cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. ERROR in p\\Test.java (at line 9)\n" + >+ " @org public Object foo() {\n" + >+ " ^^^^^^\n" + >+ "The return type is incompatible with the @NonNull return from TestInt.foo()\n" + >+ "----------\n"); >+} >+ > public void test_default_nullness_002() { > Map customOptions = getCompilerOptions(); > // customOptions.put(CompilerOptions.OPTION_ReportPotentialNullSpecViolation, JavaCore.ERROR); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >index a21174e..f3e8a5a 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >@@ -8128,7 +8128,7 @@ > Annotation[] annotations = methodDecl.annotations; > if (annotations != null) { > for (int i=0; i<annotations.length; i++) { >- if (annotations[i].resolvedType.id == TypeIds.T_ConfiguredAnnotationNullable) { >+ if (annotations[i].resolvedType != null && annotations[i].resolvedType.id == TypeIds.T_ConfiguredAnnotationNullable) { > sourceStart = annotations[i].sourceStart; > break; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 186342
:
74851
|
86246
|
86247
|
89354
|
184335
|
185507
|
186796
|
186798
|
186872
|
186876
|
186889
|
186890
|
206525
|
206557
|
207270
|
207308
|
207478
|
207565
|
207567
|
207573
|
207592
|
207604
|
207635
|
207637
|
207639
|
207657
|
207659
|
207672
|
207677
| 207685