Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java')
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java
index 5a94b556e..77ade141e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@ import java.io.IOException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.*;
@@ -1194,6 +1195,31 @@ public class ASTModelBridgeTests extends AbstractASTTests {
"LX;@LX~MyAnnot;",
bindings);
}
+
+ /*
+ * Ensures that the correct IBinding is created for package-info.class's IType
+ */
+ public void testCreateBindings24() throws CoreException {
+ createClassFile(
+ "/P/lib",
+ "pack/package-info.class",
+ "@Deprecated\n" +
+ "package pack;");
+ IJavaProject javaProject = getJavaProject("P");
+ IPackageFragment pack = javaProject.findPackageFragment(new Path("/P/lib/pack"));
+ IType type = pack.getClassFile("package-info.class").getType();
+ ASTParser parser = ASTParser.newParser(JLS3_INTERNAL);
+ parser.setProject(javaProject);
+ IJavaElement[] elements = new IJavaElement[] {type};
+ IBinding[] bindings = parser.createBindings(elements, null);
+ assertBindingsEqual(
+ "Lpack/package-info;",
+ bindings);
+ IAnnotationBinding[] annotations = ((ITypeBinding) bindings[0]).getAnnotations();
+ assertBindingsEqual(
+ "@Ljava/lang/Deprecated;",
+ annotations);
+ }
/*
* Ensures that the IJavaElement of an IBinding representing a field is correct.

Back to the top