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 76927 Details for
Bug 201104
JavaElement of a recovered type binding should not return a compilation unit with no parent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Regression test
patch_201104_tests.txt (text/plain), 3.41 KB, created by
Olivier Thomann
on 2007-08-24 12:43:31 EDT
(
hide
)
Description:
Regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2007-08-24 12:43:31 EDT
Size:
3.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v >retrieving revision 1.252 >diff -u -r1.252 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 24 Aug 2007 16:42:18 -0000 1.252 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 24 Aug 2007 16:44:13 -0000 >@@ -9398,4 +9398,55 @@ > assertNotNull("No java element", javaElement); > assertEquals("Not a type", IJavaElement.TYPE, javaElement.getElementType()); > } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=201104 >+ public void test0283() throws JavaModelException { >+ String contents = >+ "public class X {\n" + >+ " public @interface Moo {\n" + >+ " Class<?> value();\n" + >+ " }\n" + >+ " @Moo(Bar2.Baz.class)\n" + >+ " public static class Bar {\n" + >+ " public static class Baz {\n" + >+ " }\n" + >+ " }\n" + >+ "}"; >+ workingCopy = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); >+ workingCopy.getBuffer().setContents(contents); >+ ASTNode node = runConversion(AST.JLS3, workingCopy, true, true, true); >+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); >+ CompilationUnit unit = (CompilationUnit) node; >+ assertProblemsSize(unit, 1, "Bar2 cannot be resolved to a type"); >+ node = getASTNode(unit, 0, 1); >+ assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); >+ TypeDeclaration typeDeclaration = (TypeDeclaration) node; >+ final List modifiers = typeDeclaration.modifiers(); >+ assertEquals("Wrong size", 3, modifiers.size()); >+ IExtendedModifier extendedModifier = (IExtendedModifier) modifiers.get(0); >+ assertTrue("Not an annotation", extendedModifier instanceof SingleMemberAnnotation); >+ SingleMemberAnnotation annotation = (SingleMemberAnnotation) extendedModifier; >+ final Expression value = annotation.getValue(); >+ assertEquals("Not a type literal", ASTNode.TYPE_LITERAL, value.getNodeType()); >+ TypeLiteral typeLiteral = (TypeLiteral) value; >+ final Type type = typeLiteral.getType(); >+ assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType()); >+ SimpleType simpleType = (SimpleType) type; >+ final Name name = simpleType.getName(); >+ assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType()); >+ QualifiedName qualifiedName = (QualifiedName) name; >+ final IBinding binding = qualifiedName.resolveBinding(); >+ assertNotNull("No binding", binding); >+ assertEquals("Wrong value", "Bar2.Baz", qualifiedName.getFullyQualifiedName()); >+ final Name qualifier = qualifiedName.getQualifier(); >+ assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, qualifier.getNodeType()); >+ SimpleName simpleName2 = (SimpleName) qualifier; >+ final IBinding binding3 = simpleName2.resolveBinding(); >+ assertNotNull("No binding3", binding3); >+ assertTrue("Not a recovered binding", binding3.isRecovered()); >+ final IJavaElement javaElement = binding3.getJavaElement(); >+ assertNotNull("No java element", javaElement); >+ assertEquals("Not a compilation unit", IJavaElement.COMPILATION_UNIT, javaElement.getElementType()); >+ assertNotNull("No parent", javaElement.getParent()); >+ } > }
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 201104
:
76926
|
76927
|
77026