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 205181 Details for
Bug 360164
Compile error in XSDImpl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Plausible fix
patch.txt (text/plain), 8.29 KB, created by
Srikanth Sankaran
on 2011-10-14 03:53:48 EDT
(
hide
)
Description:
Plausible fix
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-10-14 03:53:48 EDT
Size:
8.29 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >index 4e1cba7..9f0995d 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >@@ -809,6 +809,7 @@ > expectedProblemAttributes.put("SuperclassNotFound", DEPRECATED); > expectedProblemAttributes.put("SuperclassNotVisible", DEPRECATED); > expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); >+ expectedProblemAttributes.put("SwitchOnEnumNotBelow15", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("SwitchOnStringsNotBelow17", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("Task", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("ThisInStaticContext", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >@@ -1482,6 +1483,7 @@ > expectedProblemAttributes.put("SuperclassNotFound", SKIP); > expectedProblemAttributes.put("SuperclassNotVisible", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_SUPERINTERFACE)); > expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT)); >+ expectedProblemAttributes.put("SwitchOnEnumNotBelow15", SKIP); > expectedProblemAttributes.put("SwitchOnStringsNotBelow17", SKIP); > expectedProblemAttributes.put("Task", SKIP); > expectedProblemAttributes.put("ThisInStaticContext", SKIP); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java >index 4375e48..8ca8999 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java >@@ -1409,6 +1409,8 @@ > int UnclosedCloseableAtExit = Internal + 888; > /** @since 3.8 */ > int ExplicitlyClosedAutoCloseable = Internal + 889; >+ /** @since 3.8 */ >+ int SwitchOnEnumNotBelow15 = TypeRelated + 890; // https://bugs.eclipse.org/bugs/show_bug.cgi?id= > /** > * External problems -- These are problems defined by other plugins > */ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java >index 609a8a5..52b9630 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java >@@ -463,6 +463,9 @@ > break checkType; > } else if (expressionType.isEnum()) { > isEnumSwitch = true; >+ if (upperScope.compilerOptions().complianceLevel < ClassFileConstants.JDK1_5) { >+ upperScope.problemReporter().incorrectSwitchType(this.expression, expressionType); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=360164 >+ } > break checkType; > } else if (upperScope.isBoxingCompatibleWith(expressionType, TypeBinding.INT)) { > this.expression.computeConversion(upperScope, TypeBinding.INT, expressionType); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >index 74dd0eb..fc77f48 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >@@ -975,9 +975,14 @@ > } > public boolean hasTypeBit(int bit) { > // ensure hierarchy is resolved, which will propagate bits down to us >- superclass(); >- superInterfaces(); >- return (this.typeBits & bit) != 0; >+ boolean wasToleratingMissingTypeProcessingAnnotations = this.environment.mayTolerateMissingType; >+ this.environment.mayTolerateMissingType = true; >+ try { >+ superclass(); >+ superInterfaces(); >+ } finally { >+ this.environment.mayTolerateMissingType = wasToleratingMissingTypeProcessingAnnotations; >+ } return (this.typeBits & bit) != 0; > } > private void initializeTypeVariable(TypeVariableBinding variable, TypeVariableBinding[] existingVariables, SignatureWrapper wrapper, char[][][] missingTypeNames) { > // ParameterSignature = Identifier ':' TypeSignature >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java >index 84d3e74..2e7fe97 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java >@@ -74,6 +74,7 @@ > private ArrayList missingTypes; > Set typesBeingConnected; > public boolean isProcessingAnnotations = false; >+ public boolean mayTolerateMissingType = false; > > final static int BUILD_FIELDS_AND_METHODS = 4; > final static int BUILD_TYPE_HIERARCHY = 1; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java >index 3038368..2da4984 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java >@@ -55,7 +55,7 @@ > } > if (targetType == null || targetType == this) { // could not resolve any better, error was already reported against it > // report the missing class file first - only if not resolving a previously missing type >- if ((this.tagBits & TagBits.HasMissingType) == 0) { >+ if ((this.tagBits & TagBits.HasMissingType) == 0 && !environment.mayTolerateMissingType) { > environment.problemReporter.isClassPathCorrect( > this.compoundName, > environment.unitBeingCompleted, >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 c84b83d..0a3b191 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 >@@ -2863,12 +2863,21 @@ > expression.sourceStart, > expression.sourceEnd); > } else { >- this.handle( >- IProblem.IncorrectSwitchType, >- new String[] {new String(testType.readableName())}, >- new String[] {new String(testType.shortReadableName())}, >- expression.sourceStart, >- expression.sourceEnd); >+ if (this.options.sourceLevel < ClassFileConstants.JDK1_5 && testType.isEnum()) { >+ this.handle( >+ IProblem.SwitchOnEnumNotBelow15, >+ new String[] {new String(testType.readableName())}, >+ new String[] {new String(testType.shortReadableName())}, >+ expression.sourceStart, >+ expression.sourceEnd); >+ } else { >+ this.handle( >+ IProblem.IncorrectSwitchType, >+ new String[] {new String(testType.readableName())}, >+ new String[] {new String(testType.shortReadableName())}, >+ expression.sourceStart, >+ expression.sourceEnd); >+ } > } > } else { > this.handle( >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >index 976a956..cfe52d1 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >@@ -651,6 +651,7 @@ > 887 = Resource leak: ''{0}'' is never closed > 888 = Resource leak: ''{0}'' is not closed at this location > 889 = Resource ''{0}'' should be managed by try-with-resource >+890 = Cannot switch on a value of type enum for source level below 1.5 > > ### ELABORATIONS > ## Access restrictions
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 360164
:
204725
|
204799
|
205181
|
205424
|
205590