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 207888 Details for
Bug 365387
[compiler][null] bug 186342: Issues to follow up post review and verification.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
regression test for item (9)
Bug_365519_item9_test.patch (text/plain), 4.51 KB, created by
Stephan Herrmann
on 2011-12-04 15:01:59 EST
(
hide
)
Description:
regression test for item (9)
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-12-04 15:01:59 EST
Size:
4.51 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 025c21c..53d8a6f 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 >@@ -2474,6 +2474,91 @@ > "Type mismatch: required \'@NonNull String\' but the provided value can be null\n" + > "----------\n"); > } >+// witness for an AIOOBE in FlowContext.recordExpectedType() >+public void test_message_send_in_control_structure_01() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(JavaCore.COMPILER_PB_NULL_SPECIFICATION_INSUFFICIENT_INFO, JavaCore.IGNORE); >+ customOptions.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.WARNING); >+ runNegativeTestWithLibs( >+ new String[] { >+ "p/Scope.java", >+ "package p;\n" + >+ "@org.eclipse.jdt.annotation.NonNullByDefault\n" + >+ "public abstract class Scope {\n" + >+ " public ReferenceBinding findMemberType(char[] typeName, ReferenceBinding enclosingType) {\n" + >+ " ReferenceBinding enclosingSourceType = enclosingSourceType();\n" + >+ " PackageBinding currentPackage = getCurrentPackage();\n" + >+ " CompilationUnitScope unitScope = compilationUnitScope();\n" + >+ " ReferenceBinding memberType = enclosingType.getMemberType(typeName);\n" + >+ " ReferenceBinding currentType = enclosingType;\n" + >+ " ReferenceBinding[] interfacesToVisit = null;\n" + >+ " while (true) {\n" + >+ " ReferenceBinding[] itsInterfaces = currentType.superInterfaces();\n" + >+ " if (itsInterfaces != null) {\n" + >+ " if (interfacesToVisit == null) {\n" + >+ " interfacesToVisit = itsInterfaces;\n" + >+ " }\n" + >+ " }\n" + >+ " unitScope.recordReference(currentType, typeName);\n" + >+ " \n" + >+ " if ((memberType = currentType.getMemberType(typeName)) != null) {\n" + >+ " if (enclosingSourceType == null\n" + >+ " ? memberType.canBeSeenBy(currentPackage)\n" + >+ " : memberType.canBeSeenBy(enclosingType, enclosingSourceType)) {\n" + >+ " return memberType;\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ " private CompilationUnitScope compilationUnitScope() {\n" + >+ " return compilationUnitScope();\n" + >+ " }\n" + >+ " private PackageBinding getCurrentPackage() {\n" + >+ " return getCurrentPackage();\n" + >+ " }\n" + >+ " private ReferenceBinding enclosingSourceType() {\n" + >+ " return enclosingSourceType();\n" + >+ " }\n" + >+ "}\n", >+ "p/CompilationUnitScope.java", >+ "package p;\n" + >+ "@org.eclipse.jdt.annotation.NonNullByDefault\n" + >+ "public class CompilationUnitScope {\n" + >+ " void recordReference(ReferenceBinding rb, char[] name) {}\n" + >+ "}\n", >+ "p/PackageBinding.java", >+ "package p;\n" + >+ "@org.eclipse.jdt.annotation.NonNullByDefault\n" + >+ "public class PackageBinding {\n" + >+ "}\n", >+ "p/ReferenceBinding.java", >+ "package p;\n" + >+ "@org.eclipse.jdt.annotation.NonNullByDefault\n" + >+ "public class ReferenceBinding {\n" + >+ " ReferenceBinding getMemberType(char[] name) { return this; }\n" + >+ " ReferenceBinding[] superInterfaces() { return new ReferenceBinding[0]; }\n" + >+ " boolean canBeSeenBy(PackageBinding ob) { return true; }\n" + >+ " boolean canBeSeenBy(ReferenceBinding rb, ReferenceBinding rb2) { return true; }\n" + >+ "}\n" >+ }, >+ customOptions, >+ "----------\n" + >+ "1. ERROR in p\\Scope.java (at line 13)\n" + >+ " if (itsInterfaces != null) {\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Redundant null check: The variable itsInterfaces cannot be null at this location\n" + >+ "----------\n" + >+ "2. ERROR in p\\Scope.java (at line 20)\n" + >+ " if ((memberType = currentType.getMemberType(typeName)) != null) {\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Redundant null check: The variable memberType cannot be null at this location\n" + >+ "----------\n" + >+ "3. ERROR in p\\Scope.java (at line 21)\n" + >+ " if (enclosingSourceType == null\n" + >+ " ^^^^^^^^^^^^^^^^^^^\n" + >+ "Null comparison always yields false: The variable enclosingSourceType cannot be null at this location\n" + >+ "----------\n"); >+} > public void test_assignment_expression_1() { > Map customOptions = getCompilerOptions(); > // customOptions.put(CompilerOptions.OPTION_ReportPotentialNullSpecViolation, JavaCore.ERROR);
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 365387
:
207842
|
207843
|
207876
| 207888 |
207952