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 153636 Details for
Bug 296629
[quick fix] Cast quick fix not offered for method-local classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_296629.txt (text/plain), 3.46 KB, created by
Olivier Thomann
on 2009-12-02 13:30:18 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-12-02 13:30:18 EST
Size:
3.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v >retrieving revision 1.106 >diff -u -r1.106 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2 Oct 2009 20:04:28 -0000 1.106 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 2 Dec 2009 18:33:33 -0000 >@@ -854,18 +854,22 @@ > case Binding.INTERSECTION_TYPE: > case Binding.GENERIC_TYPE: > return false; >- case Binding.PARAMETERIZED_TYPE: >+ case Binding.PARAMETERIZED_TYPE: > if (current.isBoundParameterizedType()) > return false; > break; > case Binding.RAW_TYPE: > return true; > } >- if (current.isStatic()) >+ if (current.isStatic()) { > return true; >+ } > if (current.isLocalType()) { >- NestedTypeBinding nestedType = (NestedTypeBinding) current.erasure(); >- if (nestedType.scope.methodScope().isStatic) return true; >+ LocalTypeBinding localTypeBinding = (LocalTypeBinding) current.erasure(); >+ MethodBinding enclosingMethod = localTypeBinding.enclosingMethod; >+ if (enclosingMethod != null && enclosingMethod.isStatic()) { >+ return true; >+ } > } > } while ((current = current.enclosingType()) != null); > return true; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java,v >retrieving revision 1.168 >diff -u -r1.168 ASTConverterTestAST3_2.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 26 Nov 2009 16:19:53 -0000 1.168 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java 2 Dec 2009 18:33:35 -0000 >@@ -122,7 +122,7 @@ > static { > // TESTS_NAMES = new String[] {"test0602"}; > // TESTS_RANGE = new int[] { 713, -1 }; >-// TESTS_NUMBERS = new int[] { 710, 711 }; >+// TESTS_NUMBERS = new int[] { 718 }; > } > public static Test suite() { > return buildModelTestSuite(ASTConverterTestAST3_2.class); >@@ -10496,4 +10496,33 @@ > } > }); > } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=296629 >+ public void test0718() throws JavaModelException { >+ ICompilationUnit workingCopy = null; >+ try { >+ workingCopy = getWorkingCopy("/Converter/src/X.java", true/*resolve*/); >+ String contents = >+ "public class X {\n" + >+ " public void v() {\n" + >+ " class Test2 {}\n" + >+ " Test2 t = get();\n" + >+ " t.toString();\n" + >+ " }\n" + >+ " public Object get() {return null;}\n" + >+ "}"; >+ >+ CompilationUnit unit = (CompilationUnit) buildAST( >+ contents, >+ workingCopy, >+ false); >+ VariableDeclarationStatement statement = (VariableDeclarationStatement) getASTNode(unit, 0, 0, 1); >+ ITypeBinding typeBinding = statement.getType().resolveBinding(); >+ ITypeBinding typeBinding2 = ((VariableDeclarationFragment) statement.fragments().get(0)).getInitializer().resolveTypeBinding(); >+ assertTrue("Is not cast compatible", typeBinding.isCastCompatible(typeBinding2)); >+ } finally { >+ if (workingCopy != null) { >+ workingCopy.discardWorkingCopy(); >+ } >+ } >+ } > } >\ No newline at end of file
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 296629
:
153625
| 153636