[279804] Clean up classes in org.eclipse.wst.jsdt.core.compiler package
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunBuilderTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunBuilderTests.java
deleted file mode 100644
index 05b59f7..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunBuilderTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests;
-
-//import org.eclipse.wst.jsdt.core.tests.builder.BuilderTests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Runs all Java builder tests.
- */
-public class RunBuilderTests extends TestCase {
-public RunBuilderTests(String name) {
- super(name);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite(RunBuilderTests.class.getName());
- //suite.addTest(BuilderTests.suite());
- return suite;
-}
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
index 8ed7553..faae149 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
@@ -18,43 +18,42 @@
import junit.framework.TestSuite;
/**
- * Runs all compiler tests (including parser tests and evaluation tests) in all compliance mode.
- * Use -Dcompliance=1.4 as a VM argument if you want to run in 1.4 compliance mode only.
- * See AbstractCompilerTests for more details.
+ * Runs all compiler tests (including parser tests) See AbstractCompilerTests
+ * for more details.
*/
public class RunCompilerTests extends TestCase {
-public RunCompilerTests(String name) {
- super(name);
-}
-public static Class[] getAllTestClasses() {
- return new Class[] {
- org.eclipse.wst.jsdt.core.tests.compiler.regression.TestAll.class,
- org.eclipse.wst.jsdt.core.tests.compiler.parser.TestAll.class,
-// org.eclipse.wst.jsdt.core.tests.eval.TestAll.class,
- };
-}
-public static Test suite() {
- TestSuite ts = new TestSuite(RunCompilerTests.class.getName());
-
- Class[] testClasses = getAllTestClasses();
- for (int i = 0; i < testClasses.length; i++) {
- Class testClass = testClasses[i];
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
+ public RunCompilerTests(String name) {
+ super(name);
}
- return ts;
-}
-}
+ public static Class[] getAllTestClasses() {
+ return new Class[] {
+ org.eclipse.wst.jsdt.core.tests.compiler.regression.TestAll.class,
+ org.eclipse.wst.jsdt.core.tests.compiler.parser.TestAll.class };
+ }
+
+ public static Test suite() {
+ TestSuite ts = new TestSuite(RunCompilerTests.class.getName());
+
+ Class[] testClasses = getAllTestClasses();
+ for (int i = 0; i < testClasses.length; i++) {
+ Class testClass = testClasses[i];
+
+ // call the suite() method and add the resulting suite to the suite
+ try {
+ Method suiteMethod = testClass.getDeclaredMethod(
+ "suite", new Class[0]); //$NON-NLS-1$
+ Test suite = (Test) suiteMethod.invoke(null, new Object[0]);
+ ts.addTest(suite);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.getTargetException().printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+ return ts;
+ }
+}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverter15Test.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverter15Test.java
deleted file mode 100644
index 6bb41e0..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverter15Test.java
+++ /dev/null
@@ -1,6168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.jsdt.core.BindingKey;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.Signature;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTMatcher;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.AssertStatement;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BodyDeclaration;
-import org.eclipse.wst.jsdt.core.dom.CastExpression;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.EnhancedForStatement;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.IExtendedModifier;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-import org.eclipse.wst.jsdt.core.dom.IPackageBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.IVariableBinding;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.Modifier;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.ParameterizedType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.QualifiedType;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.TypeParameter;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WildcardType;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-
-public class ASTConverter15Test extends ConverterTestSetup {
-
- IJavaScriptUnit workingCopy;
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS3);
- }
-
- public ASTConverter15Test(String name) {
- super(name);
- }
-
- static {
-// TESTS_NUMBERS = new int[] { 244, 245 };
-// TESTS_RANGE = new int[] { 240, -1 };
-// TESTS_NAMES = new String[] {"test0204"};
- }
- public static Test suite() {
- return buildModelTestSuite(ASTConverter15Test.class);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- if (this.workingCopy != null) {
- this.workingCopy.discardWorkingCopy();
- this.workingCopy = null;
- }
- }
-
- public void test0001() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0001", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- List types = compilationUnit.types();
- assertEquals("Wrong number of types", 1, types.size());
- AbstractTypeDeclaration typeDeclaration = (AbstractTypeDeclaration) types.get(0);
- assertEquals("wrong type", ASTNode.TYPE_DECLARATION, typeDeclaration.getNodeType());
- TypeDeclaration typeDeclaration2 = (TypeDeclaration) typeDeclaration;
- List modifiers = typeDeclaration2.modifiers();
- assertEquals("Wrong number of modifiers", 1, modifiers.size());
- Modifier modifier = (Modifier) modifiers.get(0);
- checkSourceRange(modifier, "public", source);
-
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- modifiers = fieldDeclaration.modifiers();
- assertEquals("Wrong number of modifiers", 3, modifiers.size());
- modifier = (Modifier) modifiers.get(0);
- checkSourceRange(modifier, "public", source);
- modifier = (Modifier) modifiers.get(1);
- checkSourceRange(modifier, "static", source);
- modifier = (Modifier) modifiers.get(2);
- checkSourceRange(modifier, "final", source);
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- modifiers = methodDeclaration.modifiers();
- assertEquals("Wrong number of modifiers", 2, modifiers.size());
- modifier = (Modifier) modifiers.get(0);
- checkSourceRange(modifier, "private", source);
- modifier = (Modifier) modifiers.get(1);
- checkSourceRange(modifier, "static", source);
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong number of parameters", 1, parameters.size());
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- modifiers = variableDeclaration.modifiers();
- assertEquals("Wrong number of modifiers", 1, modifiers.size());
- modifier = (Modifier) modifiers.get(0);
- checkSourceRange(modifier, "final", source);
-
- node = getASTNode(compilationUnit, 0, 2);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- modifiers = methodDeclaration.modifiers();
- assertEquals("Wrong number of modifiers", 2, modifiers.size());
- modifier = (Modifier) modifiers.get(0);
- checkSourceRange(modifier, "public", source);
- modifier = (Modifier) modifiers.get(1);
- checkSourceRange(modifier, "static", source);
- }
-
- public void test0002() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0002", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
-
- public void test0007() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0007", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- List imports = compilationUnit.imports();
- assertEquals("Wrong size", 2, imports.size());
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- checkSourceRange(importDeclaration, "import java.util.*;", source);
- assertFalse("is static", importDeclaration.isStatic());
- importDeclaration = (ImportDeclaration) imports.get(1);
- checkSourceRange(importDeclaration, "import static java.io.File.*;", source);
- assertTrue("not static", importDeclaration.isStatic());
- }
-
- /** @deprecated using deprecated code */
- public void test0008() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0008", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS2, sourceUnit, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- List imports = compilationUnit.imports();
- assertEquals("Wrong size", 2, imports.size());
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(1);
- assertTrue("Not malformed", isMalformed(importDeclaration));
- }
-
- public void test0009() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0009", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a foreach statement", node.getNodeType() == ASTNode.ENHANCED_FOR_STATEMENT);
- EnhancedForStatement enhancedForStatement = (EnhancedForStatement) node;
- checkSourceRange(enhancedForStatement, "for (String s : args) {System.out.println(s);}", source);
- SingleVariableDeclaration singleVariableDeclaration = enhancedForStatement.getParameter();
- checkSourceRange(singleVariableDeclaration, "String s", source);
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String", source);
- SimpleName simpleName = singleVariableDeclaration.getName();
- assertEquals("Wrong name", "s", simpleName.getIdentifier());
- checkSourceRange(simpleName, "s", source);
- Expression expression = enhancedForStatement.getExpression();
- checkSourceRange(expression, "args", source);
- Statement body = enhancedForStatement.getBody();
- checkSourceRange(body, "{System.out.println(s);}", source);
- }
-
- public void test0010() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0010", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertTrue("Not a foreach statement", node.getNodeType() == ASTNode.ENHANCED_FOR_STATEMENT);
- EnhancedForStatement enhancedForStatement = (EnhancedForStatement) node;
- checkSourceRange(enhancedForStatement, "for (@Foo final String s : args) {System.out.println(s);}", source);
- SingleVariableDeclaration singleVariableDeclaration = enhancedForStatement.getParameter();
- checkSourceRange(singleVariableDeclaration, "@Foo final String s", source);
- SimpleName simpleName = singleVariableDeclaration.getName();
- List modifiers = singleVariableDeclaration.modifiers();
- assertEquals("Wrong number of modifiers", 2, modifiers.size());
- IExtendedModifier modifier = (IExtendedModifier) modifiers.get(0);
- checkSourceRange((ASTNode) modifier, "@Foo", source);
- modifier = (IExtendedModifier) modifiers.get(1);
- checkSourceRange((ASTNode) modifier, "final", source);
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String", source);
- assertEquals("Wrong name", "s", simpleName.getIdentifier());
- checkSourceRange(simpleName, "s", source);
- Expression expression = enhancedForStatement.getExpression();
- checkSourceRange(expression, "args", source);
- Statement body = enhancedForStatement.getBody();
- checkSourceRange(body, "{System.out.println(s);}", source);
- }
-
- public void test0011() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0011", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertTrue("Not a foreach statement", node.getNodeType() == ASTNode.ENHANCED_FOR_STATEMENT);
- EnhancedForStatement enhancedForStatement = (EnhancedForStatement) node;
- checkSourceRange(enhancedForStatement, "for (@Foo final String s[] : args) {System.out.println(s);}", source);
- SingleVariableDeclaration singleVariableDeclaration = enhancedForStatement.getParameter();
- checkSourceRange(singleVariableDeclaration, "@Foo final String s[]", source);
- SimpleName simpleName = singleVariableDeclaration.getName();
- List modifiers = singleVariableDeclaration.modifiers();
- assertEquals("Wrong number of modifiers", 2, modifiers.size());
- IExtendedModifier modifier = (IExtendedModifier) modifiers.get(0);
- checkSourceRange((ASTNode) modifier, "@Foo", source);
- modifier = (IExtendedModifier) modifiers.get(1);
- checkSourceRange((ASTNode) modifier, "final", source);
- assertEquals("Wrong dimension", 1, singleVariableDeclaration.getExtraDimensions());
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String", source);
- assertEquals("Wrong name", "s", simpleName.getIdentifier());
- checkSourceRange(simpleName, "s", source);
- Expression expression = enhancedForStatement.getExpression();
- checkSourceRange(expression, "args", source);
- Statement body = enhancedForStatement.getBody();
- checkSourceRange(body, "{System.out.println(s);}", source);
- }
-
- public void test0012() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0012", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 1, parameters.size());
- SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(parameter, "@Foo final String[][]... args", source);
- List modifiers = parameter.modifiers();
- assertEquals("Wrong number of modifiers", 2, modifiers.size());
- ASTNode modifier = (ASTNode) modifiers.get(0);
- checkSourceRange(modifier, "@Foo", source);
- modifier = (ASTNode) modifiers.get(1);
- checkSourceRange(modifier, "final", source);
- assertEquals("Wrong name", "args", parameter.getName().getIdentifier());
- assertTrue("Not a variable argument", parameter.isVarargs());
- }
-
- public void test0013() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0013", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- assertEquals("Wrong name", "Convertible", name.getIdentifier());
- checkSourceRange(name, "Convertible", source);
- List typeParameters = typeDeclaration.typeParameters();
- assertEquals("Wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- checkSourceRange(typeParameter, "T", source);
- checkSourceRange(typeParameter.getName(), "T", source);
- node = getASTNode(compilationUnit, 1);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) node;
- name = typeDeclaration.getName();
- assertEquals("Wrong name", "X", name.getIdentifier());
- checkSourceRange(name, "X", source);
- typeParameters = typeDeclaration.typeParameters();
- assertEquals("Wrong size", 2, typeParameters.size());
- typeParameter = (TypeParameter) typeParameters.get(0);
- checkSourceRange(typeParameter.getName(), "A", source);
- checkSourceRange(typeParameter, "A extends Convertible<B>", source);
- typeParameter = (TypeParameter) typeParameters.get(1);
- checkSourceRange(typeParameter.getName(), "B", source);
- checkSourceRange(typeParameter, "B extends Convertible<A>", source);
- List typeBounds = typeParameter.typeBounds();
- assertEquals("Wrong size", 1, typeBounds.size());
- Type typeBound = (Type) typeBounds.get(0);
- checkSourceRange(typeBound, "Convertible<A>", source);
- assertEquals("wrong type", ASTNode.PARAMETERIZED_TYPE, typeBound.getNodeType());
- ParameterizedType parameterizedType = (ParameterizedType) typeBound;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "A", source);
- }
-
- public void test0014() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0014", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- assertEquals("Wrong name", "X", name.getIdentifier());
- checkSourceRange(name, "X", source);
- List typeParameters = typeDeclaration.typeParameters();
- assertEquals("Wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- checkSourceRange(typeParameter.getName(), "A", source);
- checkSourceRange(typeParameter, "A extends Convertible<Convertible<A>>", source);
- List typeBounds = typeParameter.typeBounds();
- assertEquals("Wrong size", 1, typeBounds.size());
- Type typeBound = (Type) typeBounds.get(0);
- checkSourceRange(typeBound, "Convertible<Convertible<A>>", source);
- assertEquals("wrong type", ASTNode.PARAMETERIZED_TYPE, typeBound.getNodeType());
- ParameterizedType parameterizedType = (ParameterizedType) typeBound;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "Convertible<A>", source);
- assertEquals("wrong type", ASTNode.PARAMETERIZED_TYPE, typeArgument.getNodeType());
- parameterizedType = (ParameterizedType) typeArgument;
- typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "A", source);
- }
-
- public void test0015() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0015", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- assertEquals("Wrong name", "X", name.getIdentifier());
- checkSourceRange(name, "X", source);
- List typeParameters = typeDeclaration.typeParameters();
- assertEquals("Wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- checkSourceRange(typeParameter.getName(), "A", source);
- checkSourceRange(typeParameter, "A extends Object & java.io.Serializable & Comparable<?>", source);
- List typeBounds = typeParameter.typeBounds();
- assertEquals("Wrong size", 3, typeBounds.size());
- Type typeBound = (Type) typeBounds.get(0);
- checkSourceRange(typeBound, "Object", source);
- typeBound = (Type) typeBounds.get(1);
- checkSourceRange(typeBound, "java.io.Serializable", source);
- typeBound = (Type) typeBounds.get(2);
- checkSourceRange(typeBound, "Comparable<?>", source);
- }
-
- public void test0016() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0016", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedProblems =
- "Pair is a raw type. References to generic type Pair<A,B> should be parameterized\n" +
- "Pair is a raw type. References to generic type Pair<A,B> should be parameterized";
- assertProblemsSize(compilationUnit, 2, expectedProblems);
- ASTNode node = getASTNode(compilationUnit, 0, 5);
- assertEquals("Wrong first character", '<', source[node.getStartPosition()]);
- }
-
- public void test0017() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0017", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- ITypeBinding binding = initializer.resolveTypeBinding();
- assertNotNull("No binding", binding);
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "Integer", source);
- Type innerType = parameterizedType.getType();
- assertTrue("Not a qualified type", innerType.getNodeType() == ASTNode.QUALIFIED_TYPE);
- QualifiedType qualifiedType = (QualifiedType) innerType;
- checkSourceRange(qualifiedType.getName(), "B", source);
- Type qualifier = qualifiedType.getQualifier();
- checkSourceRange(qualifier, "test0017.A<String>", source);
- assertTrue("Not a parameterized type", qualifier.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType2 = (ParameterizedType) qualifier;
- typeArguments = parameterizedType2.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "String", source);
- innerType = parameterizedType2.getType();
- assertTrue("Not a simple type", innerType.getNodeType() == ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) innerType;
- checkSourceRange(simpleType, "test0017.A", source);
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.getNodeType() == ASTNode.QUALIFIED_NAME);
- QualifiedName qualifiedName = (QualifiedName) name;
- checkSourceRange(qualifiedName.getQualifier(), "test0017", source);
- checkSourceRange(qualifiedName.getName(), "A", source);
- }
-
- public void test0018() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0018", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "Float", source);
- Type innerType = parameterizedType.getType();
- assertTrue("Not a qualified type", innerType.getNodeType() == ASTNode.QUALIFIED_TYPE);
- QualifiedType qualifiedType = (QualifiedType) innerType;
- checkSourceRange(qualifiedType.getName(), "C", source);
- Type qualifier = qualifiedType.getQualifier();
- checkSourceRange(qualifier, "test0018.A<String>.B", source);
- assertTrue("Not a qualified type", qualifier.getNodeType() == ASTNode.QUALIFIED_TYPE);
- qualifiedType = (QualifiedType) qualifier;
- checkSourceRange(qualifiedType.getName(), "B", source);
- qualifier = qualifiedType.getQualifier();
- checkSourceRange(qualifier, "test0018.A<String>", source);
- assertTrue("Not a parameterized type", qualifier.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType2 = (ParameterizedType) qualifier;
- typeArguments = parameterizedType2.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "String", source);
- innerType = parameterizedType2.getType();
- assertTrue("Not a simple type", innerType.getNodeType() == ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) innerType;
- checkSourceRange(simpleType, "test0018.A", source);
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.getNodeType() == ASTNode.QUALIFIED_NAME);
- QualifiedName qualifiedName = (QualifiedName) name;
- checkSourceRange(qualifiedName.getQualifier(), "test0018", source);
- checkSourceRange(qualifiedName.getName(), "A", source);
- }
-
- public void test0019() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0019", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a qualified type", type.getNodeType() == ASTNode.QUALIFIED_TYPE);
- QualifiedType qualifiedType = (QualifiedType) type;
- checkSourceRange(qualifiedType.getName(), "C", source);
- Type qualifier = qualifiedType.getQualifier();
- checkSourceRange(qualifier, "test0019.A<String>.B<Integer>", source);
- assertTrue("Not a parameterized type", qualifier.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType = (ParameterizedType) qualifier;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "Integer", source);
- Type innerType = parameterizedType.getType();
- assertTrue("Not a qualified type", innerType.getNodeType() == ASTNode.QUALIFIED_TYPE);
- qualifiedType = (QualifiedType) innerType;
- checkSourceRange(qualifiedType.getName(), "B", source);
- qualifier = qualifiedType.getQualifier();
- checkSourceRange(qualifier, "test0019.A<String>", source);
- assertTrue("Not a parameterized type", qualifier.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType2 = (ParameterizedType) qualifier;
- typeArguments = parameterizedType2.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "String", source);
- innerType = parameterizedType2.getType();
- assertTrue("Not a simple type", innerType.getNodeType() == ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) innerType;
- checkSourceRange(simpleType, "test0019.A", source);
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.getNodeType() == ASTNode.QUALIFIED_NAME);
- QualifiedName qualifiedName = (QualifiedName) name;
- checkSourceRange(qualifiedName.getQualifier(), "test0019", source);
- checkSourceRange(qualifiedName.getName(), "A", source);
- }
-
- public void test0020() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0020", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- assertTrue("Not a parameterized type", type.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "?", source);
- }
-
- public void test0021() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0021", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- assertTrue("Not a parameterized type", type.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "? extends E", source);
- assertTrue("Not a wildcard type", typeArgument.getNodeType() == ASTNode.WILDCARD_TYPE);
- WildcardType wildcardType = (WildcardType) typeArgument;
- Type bound = wildcardType.getBound();
- checkSourceRange(bound, "E", source);
- assertTrue("Not an upper bound", wildcardType.isUpperBound());
- }
-
- public void test0022() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0022", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- assertTrue("Not a parameterized type", type.getNodeType() == ASTNode.PARAMETERIZED_TYPE);
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "? super E", source);
- assertTrue("Not a wildcard type", typeArgument.getNodeType() == ASTNode.WILDCARD_TYPE);
- WildcardType wildcardType = (WildcardType) typeArgument;
- Type bound = wildcardType.getBound();
- checkSourceRange(bound, "E", source);
- assertFalse("Is an upper bound", wildcardType.isUpperBound());
- }
-
- public void test0023() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0023", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedProblems =
- "Pair is a raw type. References to generic type Pair<A,B> should be parameterized\n" +
- "Pair is a raw type. References to generic type Pair<A,B> should be parameterized";
- assertProblemsSize(compilationUnit, 2, expectedProblems);
- ASTNode node = getASTNode(compilationUnit, 0, 5);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("Wrong name", "zip", methodDeclaration.getName().getIdentifier());
- List typeParameters = methodDeclaration.typeParameters();
- assertNotNull("No type parameters", typeParameters);
- assertEquals("Wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- checkSourceRange(typeParameter, "T", source);
- }
-
- public void test0024() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0024", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement declarationStatement = (VariableDeclarationStatement) node;
- List fragments = declarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- List typeArguments = classInstanceCreation.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- Type type = (Type) typeArguments.get(0);
- checkSourceRange(type, "String", source);
- }
-
- public void test0025() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0025", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a constructor invocation", ASTNode.CONSTRUCTOR_INVOCATION, node.getNodeType());
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- List typeArguments = constructorInvocation.typeArguments();
- assertEquals("wrong size", 1, typeArguments.size());
- Type type = (Type) typeArguments.get(0);
- checkSourceRange(type, "E", source);
- }
-
-
- public void test0028() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0028", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- checkSourceRange(methodDeclaration.getName(), "foo", source);
- checkSourceRange(methodDeclaration, "void foo(String[] args) {\n" +
- " if (args.length < 2) {\n" +
- " System.out.println(\"Usage: X <double> <double>\");\n" +
- " return;\n" +
- " }\n" +
- " double x = Double.parseDouble(args[0]);\n" +
- " double y = Double.parseDouble(args[1]);\n" +
- "\n" +
- " for (X op : X.values())\n" +
- " System.out.println(x + \" \" + op + \" \" + y + \" = \" + op.eval(x, y));\n" +
- " }", source);
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- checkSourceRange(methodDeclaration.getName(), "bar", source);
- checkSourceRange(methodDeclaration, "abstract double bar(double x, double y);", source);
- }
-
- public void test0029() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0029", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=67790
- */
- public void test0030() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0030", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a constructor invocation", ASTNode.CONSTRUCTOR_INVOCATION, node.getNodeType());
- checkSourceRange(node, "<T>this();", source);
- }
-
- public void test0031() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0031", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- public void test0032() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0032", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List superInterfaces = typeDeclaration.superInterfaceTypes();
- assertEquals("wrong size", 1, superInterfaces.size());
- Type type = (Type) superInterfaces.get(0);
- assertEquals("wrong type", ASTNode.PARAMETERIZED_TYPE, type.getNodeType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- Type type2 = parameterizedType.getType();
- checkSourceRange(type2, "C", source);
- }
-
- public void test0033() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0033", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- public void test0034() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0034", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=70292
- */
- public void test0035() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0035", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=67790
- */
- public void test0036() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0036", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- checkSourceRange(expressionStatement, "this.<T>foo();", source);
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- checkSourceRange(methodInvocation, "this.<T>foo()", source);
- List typeArguments = methodInvocation.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=68838
- */
- public void test0037() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0037", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List typeParameters = typeDeclaration.typeParameters();
- assertEquals("Wrong size", 2, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- IBinding binding = typeParameter.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertEquals("Wrong name", "T", typeBinding.getName());
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- assertEquals("Wrong key", "Ltest0037/X;:TT;", typeBinding.getKey());
- SimpleName simpleName = typeParameter.getName();
- assertEquals("Wrong name", "T", simpleName.getIdentifier());
- IBinding binding2 = simpleName.resolveBinding();
- assertNotNull("No binding", binding2);
- assertEquals("Wrong type", IBinding.TYPE, binding2.getKind());
- ITypeBinding typeBinding2 = (ITypeBinding) binding2;
- assertEquals("Wrong name", "T", typeBinding2.getName());
- ITypeBinding typeBinding3 = simpleName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding3);
- assertEquals("Wrong type", IBinding.TYPE, typeBinding3.getKind());
- assertEquals("Wrong name", "T", typeBinding3.getName());
-
- typeParameter = (TypeParameter) typeParameters.get(1);
- binding = typeParameter.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- typeBinding = (ITypeBinding) binding;
- assertEquals("Wrong name", "U", typeBinding.getName());
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- assertEquals("Wrong key", "Ltest0037/X;:TU;", typeBinding.getKey());
- simpleName = typeParameter.getName();
- assertEquals("Wrong name", "U", simpleName.getIdentifier());
- binding2 = simpleName.resolveBinding();
- assertNotNull("No binding", binding2);
- assertEquals("Wrong type", IBinding.TYPE, binding2.getKind());
- typeBinding2 = (ITypeBinding) binding2;
- assertEquals("Wrong name", "U", typeBinding2.getName());
- typeBinding3 = simpleName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding3);
- assertEquals("Wrong type", IBinding.TYPE, typeBinding3.getKind());
- assertEquals("Wrong name", "U", typeBinding3.getName());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=69066
- */
- public void test0038() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0038", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- checkSourceRange(typeArgument, "T", source);
- ITypeBinding typeBinding = typeArgument.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name", "T", typeBinding.getName());
- ITypeBinding[] typeParameters = typeBinding.getTypeParameters();
- assertEquals("Wrong size", 0, typeParameters.length);
- assertEquals("Wrong isArray", false, typeBinding.isArray());
- assertEquals("Wrong isAnnotation", false, typeBinding.isAnnotation());
- assertEquals("Wrong isAnonymous", false, typeBinding.isAnonymous());
- assertEquals("Wrong isClass", false, typeBinding.isClass());
- assertEquals("Wrong isEnum", false, typeBinding.isEnum());
- assertEquals("Wrong isInterface", false, typeBinding.isInterface());
- assertEquals("Wrong isGenericType", false, typeBinding.isGenericType());
- assertEquals("Wrong isLocal", false, typeBinding.isLocal());
- assertEquals("Wrong isMember", false, typeBinding.isMember());
- assertEquals("Wrong isNested", false, typeBinding.isNested());
- assertEquals("Wrong isNullType", false, typeBinding.isNullType());
- assertEquals("Wrong isParameterizedType", false, typeBinding.isParameterizedType());
- assertEquals("Wrong isPrimitive", false, typeBinding.isPrimitive());
- assertEquals("Wrong isRawType", false, typeBinding.isRawType());
- assertEquals("Wrong isTopLevel", false, typeBinding.isTopLevel());
- assertEquals("Wrong isTypeVariable", true, typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- assertEquals("Wrong isWildcardType", false, typeBinding.isWildcardType());
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertEquals("Wrong name", "X<T>", typeBinding2.getName());
- assertEquals("Wrong isArray", false, typeBinding2.isArray());
- assertEquals("Wrong isAnnotation", false, typeBinding2.isAnnotation());
- assertEquals("Wrong isAnonymous", false, typeBinding2.isAnonymous());
- assertEquals("Wrong isClass", true, typeBinding2.isClass());
- assertEquals("Wrong isEnum", false, typeBinding2.isEnum());
- assertEquals("Wrong isInterface", false, typeBinding2.isInterface());
- assertEquals("Wrong isGenericType", false, typeBinding2.isGenericType());
- assertEquals("Wrong isLocal", false, typeBinding2.isLocal());
- assertEquals("Wrong isMember", false, typeBinding2.isMember());
- assertEquals("Wrong isNested", false, typeBinding2.isNested());
- assertEquals("Wrong isNullType", false, typeBinding2.isNullType());
- assertEquals("Wrong isParameterizedType", true, typeBinding2.isParameterizedType());
- assertEquals("Wrong isPrimitive", false, typeBinding2.isPrimitive());
- assertEquals("Wrong isRawType", false, typeBinding2.isRawType());
- assertEquals("Wrong isTopLevel", true, typeBinding2.isTopLevel());
- assertEquals("Wrong isTypeVariable", false, typeBinding2.isTypeVariable());
- assertEquals("Wrong isWildcardType", false, typeBinding2.isWildcardType());
- typeParameters = typeBinding2.getTypeParameters();
- assertEquals("Wrong size", 0, typeParameters.length);
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72233
- */
- public void test0039() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0039", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72248
- */
- public void test0040() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0040", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List typeParameters = methodDeclaration.typeParameters();
- assertEquals("wrong size", 1, typeParameters.size());
- TypeParameter parameter = (TypeParameter) typeParameters.get(0);
- IBinding binding = parameter.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- assertEquals("wrong key", "Ltest0040/X;.foo<T:Ljava/lang/Object;>()TT;:TT;", binding.getKey());
- Type returnType = methodDeclaration.getReturnType2();
- IBinding binding2 = returnType.resolveBinding();
- assertNotNull("No binding", binding2);
- assertEquals("wrong type", IBinding.TYPE, binding2.getKind());
- assertEquals("wrong key", "Ltest0040/X;.foo<T:Ljava/lang/Object;>()TT;:TT;", binding2.getKey());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72477
- */
- public void test0041() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0041", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=73048
- */
- public void test0042() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0042", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List typeParameters = methodDeclaration.typeParameters();
- assertEquals("wrong size", 1, typeParameters.size());
- TypeParameter parameter = (TypeParameter) typeParameters.get(0);
- IBinding binding = parameter.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- assertEquals("wrong key", "Ltest0042/X;.foo<T:Ljava/lang/Object;>()[TT;:TT;", binding.getKey());
- Type returnType = methodDeclaration.getReturnType2();
- IBinding binding2 = returnType.resolveBinding();
- assertNotNull("No binding", binding2);
- assertEquals("wrong type", IBinding.TYPE, binding2.getKind());
- assertEquals("wrong key", "[Ltest0042/X;.foo<T:Ljava/lang/Object;>()[TT;:TT;", binding2.getKey());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72882
- */
- public void test0043() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0043", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List typeParameters = typeDeclaration.typeParameters();
- assertEquals("Wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- IBinding binding = typeParameter.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertEquals("Wrong qualified name", "T", typeBinding.getQualifiedName());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72891
- */
- public void test0044() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0044", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List typeParameters = methodDeclaration.typeParameters();
- assertEquals("wrong size", 1, typeParameters.size());
- TypeParameter parameter = (TypeParameter) typeParameters.get(0);
- IBinding binding = parameter.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- assertEquals("wrong key", "Ltest0044/X;.foo<Z:Ljava/lang/Object;>(TZ;)V:TZ;", binding.getKey());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("no binding", methodBinding);
- assertEquals("Wrong isConstructor", false, methodBinding.isConstructor());
- assertEquals("Wrong isDefaultConstructor", false, methodBinding.isDefaultConstructor());
- assertEquals("Wrong isDeprecated", false, methodBinding.isDeprecated());
- assertEquals("Wrong isGenericMethod", true, methodBinding.isGenericMethod());
- assertEquals("Wrong isParameterizedMethod", false, methodBinding.isParameterizedMethod());
- assertEquals("Wrong isRawMethod", false, methodBinding.isRawMethod());
- assertEquals("Wrong isSynthetic", false, methodBinding.isSynthetic());
- assertEquals("Wrong isVarargs", false, methodBinding.isVarargs());
- ITypeBinding[] typeParametersBindings = methodBinding.getTypeParameters();
- assertNotNull("No type parameters", typeParametersBindings);
- assertEquals("Wrong size", 1, typeParametersBindings.length);
- ITypeBinding typeBinding = typeParametersBindings[0];
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- assertEquals("Wrong fully qualified name", "Z", typeBinding.getQualifiedName());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72891
- */
- public void test0045() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0045", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 1);
- assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not a expression statement", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding();
- assertTrue("Not parameterized", methodBinding.isParameterizedMethod());
- ITypeBinding[] typeArguments = methodBinding.getTypeArguments();
- assertNotNull("No type arguments", typeArguments);
- assertEquals("Wrong size", 1, typeArguments.length);
- assertEquals("Wrong qualified name", "java.lang.String", typeArguments[0].getQualifiedName());
- IFunctionBinding genericMethod = methodBinding.getMethodDeclaration();
- assertNotNull("No generic method", genericMethod);
- assertFalse("Not a parameterized method", genericMethod.isParameterizedMethod());
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72889
- */
- public void test0046() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0046", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- Type superclassType = typeDeclaration.getSuperclassType();
- ITypeBinding typeBinding = superclassType.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- String key1 = typeBinding.getKey();
- node = getASTNode(compilationUnit, 1, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- String key2 = typeBinding.getKey();
- assertFalse("Same keys", key1.equals(key2));
- }
-
- /**
- * Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72859
- */
- public void test0047() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0047", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
-
- /**
- * Ellipsis
- */
- public void test0050() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0050", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- final String expectedOutput = "Extended dimensions are illegal for a variable argument";
- assertProblemsSize(compilationUnit, 1, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- assertTrue("Not a varargs", singleVariableDeclaration.isVarargs());
- final Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String[]", source);
- assertTrue("not an array type", type.isArrayType());
- ArrayType arrayType = (ArrayType) type;
- checkSourceRange(arrayType.getComponentType(), "String", source);
- assertEquals("Wrong extra dimensions", 1, singleVariableDeclaration.getExtraDimensions());
- }
-
- /**
- * Ellipsis
- */
- public void test0051() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0051", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertTrue("Not a varargs", methodBinding.isVarargs());
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- assertTrue("Not a varargs", singleVariableDeclaration.isVarargs());
- final Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String[]", source);
- assertTrue("not an array type", type.isArrayType());
- ArrayType arrayType = (ArrayType) type;
- checkSourceRange(arrayType.getComponentType(), "String", source);
- assertEquals("Wrong extra dimensions", 0, singleVariableDeclaration.getExtraDimensions());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=76103
- */
- public void test0052() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0052", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
-
- /**
- *
- */
- public void test0056() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0056", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- final String expectedOutput = "Zork1 cannot be resolved to a type";
- assertProblemsSize(compilationUnit, 1, expectedOutput);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77249
- */
- public void test0058() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0058", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, false, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertTrue("Not public type declaration", Modifier.isPublic(typeDeclaration.getModifiers()));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77772
- */
- public void test0059() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0059", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /*
- * Ensures that the type parameters of a method are included in its binding key.
- * (regression test for 73970 [1.5][dom] overloaded parameterized methods have same method binding key)
- */
- public void test0060() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "/*start*/public class X {\n" +
- " <T> void foo(T t) {\n" +
- " }\n" +
- " <T extends X> void foo(T t) {\n" +
- " }\n" +
- " <T extends Class> void foo(T t) {\n" +
- " }\n" +
- " <T extends Exception & Runnable> void foo(T t) {\n" +
- " }\n" +
- "}/*end*/",
- this.workingCopy,
- false);
- FunctionDeclaration[] methods = ((TypeDeclaration) node).getMethods();
- int length = methods.length;
- String[] keys = new String[length];
- for (int i = 0; i < length; i++)
- keys[i] = methods[i].resolveBinding().getKey();
- assertBindingKeysEqual(
- "Lp/X;.foo<T:Ljava/lang/Object;>(TT;)V\n" +
- "Lp/X;.foo<T:Lp/X;>(TT;)V\n" +
- "Lp/X;.foo<T:Ljava/lang/Class;>(TT;)V\n" +
- "Lp/X;.foo<T:Ljava/lang/Exception;:Ljava/lang/Runnable;>(TT;)V",
- keys);
- }
-
- /*
- * Ensures that the type parameters of a generic type are included in its binding key.
- * (regression test for 77808 [1.5][dom] type bindings for raw List and List<E> have same key)
- */
- public void test0061() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "/*start*/public class X<T> {\n" +
- "}/*end*/",
- this.workingCopy);
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertBindingKeyEquals(
- "Lp/X<TT;>;",
- binding.getKey());
- }
-
- /*
- * Ensures that the type arguments of a parameterized type are included in its binding key.
- */
- public void test0062() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X<T> {\n" +
- " /*start*/X<Class>/*end*/ f;\n" +
- "}",
- this.workingCopy,
- false);
- IBinding binding = ((Type) node).resolveBinding();
- assertBindingKeyEquals(
- "Lp/X<Ljava/lang/Class<>;>;",
- binding.getKey());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78183
- */
- public void test0063() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0063", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Wrong node", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name", "test0063.X", typeBinding.getQualifiedName());
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Wrong node", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- typeBinding = expression.resolveTypeBinding();
- assertTrue("Not parameterized", typeBinding.isParameterizedType());
- assertEquals("Wrong qualified name", "test0063.X<java.lang.String>", typeBinding.getQualifiedName());
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Wrong node", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration declaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = declaration.getType();
- typeBinding = type.resolveBinding();
- assertEquals("Wrong qualified name", "java.util.List<? extends test0063.X<?>>", typeBinding.getQualifiedName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78183
- */
- public void test0064() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0064", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Wrong node", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name", "test0064.X", typeBinding.getQualifiedName());
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Wrong node", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- typeBinding = expression.resolveTypeBinding();
- assertTrue("Not parameterized", typeBinding.isParameterizedType());
- assertEquals("Wrong qualified name", "test0064.X<java.lang.String,java.lang.Integer>", typeBinding.getQualifiedName());
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Wrong node", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration declaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = declaration.getType();
- typeBinding = type.resolveBinding();
- assertEquals("Wrong qualified name", "java.util.List<? extends test0064.X<?,?>>", typeBinding.getQualifiedName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78183
- */
- public void test0065() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0065", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Wrong node", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name", "test0065.X", typeBinding.getQualifiedName());
- ITypeBinding genericType = typeBinding.getTypeDeclaration();
- assertEquals("Wrong qualified name", "test0065.X", genericType.getQualifiedName());
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Wrong node", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- typeBinding = expression.resolveTypeBinding();
- assertTrue("Not parameterized", typeBinding.isParameterizedType());
- assertEquals("Wrong qualified name", "test0065.X<java.lang.String,java.util.List<?>>", typeBinding.getQualifiedName());
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Wrong node", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration declaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = declaration.getType();
- typeBinding = type.resolveBinding();
- assertEquals("Wrong qualified name", "java.util.List<? extends test0065.X<?,?>>", typeBinding.getQualifiedName());
- }
-
- /*
- * Ensures that a raw type doesn't include the type parameters in its binding key.
- * (regression test for 77808 [1.5][dom] type bindings for raw List and List<E> have same key)
- */
- public void test0066() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X<T> {\n" +
- " /*start*/X/*end*/ field;" +
- "}",
- this.workingCopy,
- false);
- IBinding binding = ((Type) node).resolveBinding();
- assertBindingKeyEquals(
- "Lp/X<>;",
- binding.getKey());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78649
- */
- public void test0067() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0067", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Wrong node", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type type2 = (Type) typeArguments.get(0);
- assertTrue("Not a wildcard type", type2.isWildcardType());
- WildcardType wildcardType = (WildcardType) type2;
- assertTrue("Not an upperbound type", wildcardType.isUpperBound());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78649
- */
- public void test0068() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0068", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Wrong node", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type type2 = (Type) typeArguments.get(0);
- assertTrue("Not a wildcard type", type2.isWildcardType());
- WildcardType wildcardType = (WildcardType) type2;
- assertFalse("An upperbound type", wildcardType.isUpperBound());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78934
- */
- public void test0069() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0069", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- assertNotNull("No binding", parameterizedType.resolveBinding());
- Type type2 = parameterizedType.getType();
- assertTrue("Not a qualified type", type2.isQualifiedType());
- QualifiedType qualifiedType = (QualifiedType) type2;
- ITypeBinding typeBinding = qualifiedType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 1", "test0069.Outer<java.lang.String>.Inner<java.lang.Integer>", typeBinding.getQualifiedName());
- SimpleName simpleName = qualifiedType.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", simpleName.resolveBinding());
- assertEquals("Wrong name 2", "test0069.Outer<java.lang.String>.Inner<java.lang.Integer>", typeBinding.getQualifiedName());
- Type type3 = qualifiedType.getQualifier();
- assertTrue("Not a parameterized type", type3.isParameterizedType());
- ParameterizedType parameterizedType2 = (ParameterizedType) type3;
- typeBinding = parameterizedType2.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 3", "test0069.Outer<java.lang.String>", typeBinding.getQualifiedName());
- Type type4 = parameterizedType2.getType();
- assertTrue("Not a simple type", type4.isSimpleType());
- SimpleType simpleType = (SimpleType) type4;
- assertNotNull("No binding", simpleType.resolveBinding());
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- assertNotNull("No binding", qualifiedName.resolveBinding());
- Name name2 = qualifiedName.getQualifier();
- assertTrue("Not a simpleName", name2.isSimpleName());
- SimpleName simpleName2 = (SimpleName) name2;
- binding = simpleName2.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.PACKAGE, binding.getKind());
- SimpleName simpleName3 = qualifiedName.getName();
- assertNotNull("No binding", simpleName3.resolveBinding());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78934
- */
- public void test0070() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0070", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- assertNotNull("No binding", parameterizedType.resolveBinding());
- Type type2 = parameterizedType.getType();
- assertTrue("Not a qualified type", type2.isQualifiedType());
- QualifiedType qualifiedType = (QualifiedType) type2;
- ITypeBinding typeBinding = qualifiedType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 1", "test0070.Outer<java.lang.String>.Inner<java.lang.Number>", typeBinding.getQualifiedName());
- SimpleName simpleName = qualifiedType.getName();
- typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 2", "test0070.Outer<java.lang.String>.Inner<java.lang.Number>", typeBinding.getQualifiedName());
- Type type3 = qualifiedType.getQualifier();
- assertTrue("Not a parameterized type", type3.isParameterizedType());
- ParameterizedType parameterizedType2 = (ParameterizedType) type3;
- typeBinding = parameterizedType2.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 3", "test0070.Outer<java.lang.String>", typeBinding.getQualifiedName());
- Type type4 = parameterizedType2.getType();
- assertTrue("Not a simple type", type4.isSimpleType());
- SimpleType simpleType = (SimpleType) type4;
- typeBinding = simpleType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 3", "test0070.Outer<java.lang.String>", typeBinding.getQualifiedName());
- Name name = simpleType.getName();
- assertTrue("Not a simpleName", name.isSimpleName());
- SimpleName simpleName2 = (SimpleName) name;
- typeBinding = simpleName2.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name 3", "test0070.Outer", typeBinding.getQualifiedName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78930
- */
- public void test0071() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0071", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List typeParameters = methodDeclaration.typeParameters();
- assertEquals("wrong size", 1, typeParameters.size());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- ITypeBinding[] typeBindings = methodBinding.getTypeParameters();
- assertEquals("wrong size", 1, typeBindings.length);
- ITypeBinding typeBinding = typeBindings[0];
- IJavaScriptElement javaElement = typeBinding.getJavaElement();
- assertNotNull("No java element", javaElement);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77645
- */
- public void test0072() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15", "src", "test0072", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 0);
- unit.accept(new ASTVisitor() {
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration)
- */
- public boolean visit(SingleVariableDeclaration node) {
- IVariableBinding binding = node.resolveBinding();
- assertNotNull("No method", binding.getDeclaringMethod());
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment)
- */
- public boolean visit(VariableDeclarationFragment node) {
- IVariableBinding binding = node.resolveBinding();
- ASTNode parent = node.getParent();
- if (parent != null && binding != null) {
- final IFunctionBinding declaringMethod = binding.getDeclaringMethod();
- final String variableBindingName = binding.getName();
- switch(parent.getNodeType()) {
- case ASTNode.FIELD_DECLARATION :
- assertNull("Got a method", declaringMethod);
- break;
- default :
- if (variableBindingName.equals("var1")
- || variableBindingName.equals("var2")) {
- assertNull("Got a method", declaringMethod);
- } else {
- assertNotNull("No method", declaringMethod);
- String methodName = declaringMethod.getName();
- if (variableBindingName.equals("var4")) {
- assertEquals("Wrong method", "foo", methodName);
- } else if (variableBindingName.equals("var5")) {
- assertEquals("Wrong method", "foo2", methodName);
- } else if (variableBindingName.equals("var7")) {
- assertEquals("Wrong method", "foo3", methodName);
- } else if (variableBindingName.equals("var8")) {
- assertEquals("Wrong method", "X", methodName);
- } else if (variableBindingName.equals("var9")) {
- assertEquals("Wrong method", "bar3", methodName);
- } else if (variableBindingName.equals("var10")) {
- assertEquals("Wrong method", "bar3", methodName);
- } else if (variableBindingName.equals("var11")) {
- assertEquals("Wrong method", "bar3", methodName);
- } else if (variableBindingName.equals("var12")) {
- assertEquals("Wrong method", "X", methodName);
- }
- }
- }
- }
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.FieldAccess)
- */
- public boolean visit(FieldAccess node) {
- IVariableBinding binding = node.resolveFieldBinding();
- assertNull("No method", binding.getDeclaringMethod());
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperFieldAccess)
- */
- public boolean visit(SuperFieldAccess node) {
- IVariableBinding binding = node.resolveFieldBinding();
- assertNull("No method", binding.getDeclaringMethod());
- return false;
- }
- });
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77806
- */
- public void test0073() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0073", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- assertNotNull("No binding", type.resolveBinding());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- ITypeBinding binding = parameterizedType.resolveBinding();
- assertNotNull("No binding", binding);
- Type type2 = parameterizedType.getType();
- assertTrue("Not a simple type", type2.isSimpleType());
- ITypeBinding binding2 = type2.resolveBinding();
- assertNotNull("No binding", binding2);
- SimpleType simpleType = (SimpleType) type2;
- Name name = simpleType.getName();
- assertTrue("Not a simpleName", name.isSimpleName());
- SimpleName simpleName = (SimpleName) name;
- ITypeBinding binding3 = simpleName.resolveTypeBinding();
- assertNotNull("No binding", binding3);
- assertTrue("Different binding", binding3.isEqualTo(binding));
- assertTrue("Different binding", binding2.isEqualTo(binding));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78934
- */
- public void test0074() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0074", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- assertNotNull("No binding", type.resolveBinding());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- Type type2 = parameterizedType.getType();
- assertTrue("Not a simple type", type2.isSimpleType());
- final ITypeBinding binding = type2.resolveBinding();
- assertNotNull("No binding", binding);
- SimpleType simpleType = (SimpleType) type2;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- SimpleName simpleName = qualifiedName.getName();
- ITypeBinding binding2 = simpleName.resolveTypeBinding();
- assertNotNull("No binding", binding2);
- assertTrue("Different binding", binding2.isEqualTo(binding));
- assertEquals("wrong name", "java.util.List<java.lang.String>", binding2.getQualifiedName());
- Name name2 = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", name2.isQualifiedName());
- QualifiedName qualifiedName2 = (QualifiedName) name2;
- IBinding binding3 = qualifiedName2.resolveBinding();
- assertNotNull("No binding", binding3);
- assertEquals("wrong kind", IBinding.PACKAGE, binding3.getKind());
- assertEquals("wrong name2", "java.util", binding3.getName());
- simpleName = qualifiedName2.getName();
- binding3 = simpleName.resolveBinding();
- assertNotNull("No binding", binding3);
- assertEquals("wrong kind", IBinding.PACKAGE, binding3.getKind());
- assertEquals("wrong name2", "java.util", binding3.getName());
- name2 = qualifiedName2.getQualifier();
- assertTrue("Not a simple name", name2.isSimpleName());
- simpleName = (SimpleName) name2;
- binding3 = simpleName.resolveBinding();
- assertNotNull("No binding", binding3);
- assertEquals("wrong kind", IBinding.PACKAGE, binding3.getKind());
- assertEquals("wrong name2", "java", binding3.getName());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79271
- */
- public void test0075() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "import java.util.ArrayList;\n" +
- "public class X {\n" +
- " /*start*/ArrayList<Integer>/*end*/ field;" +
- "}",
- this.workingCopy);
- ITypeBinding binding = ((Type) node).resolveBinding();
- ITypeBinding genericType = binding.getTypeDeclaration();
- assertFalse("Equals", binding.isEqualTo(genericType));
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79362
- */
- public void test0076() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0076", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput = "Type mismatch: cannot convert from Map[] to Map<String,Double>[][]";
- assertProblemsSize(compilationUnit, 1, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Map<String, Double>[][]", source);
- assertEquals("wrong type", ASTNode.ARRAY_TYPE, type.getNodeType());
- ArrayType arrayType = (ArrayType) type;
- type = arrayType.getComponentType();
- checkSourceRange(type, "Map<String, Double>[]", source);
- assertEquals("wrong type", ASTNode.ARRAY_TYPE, type.getNodeType());
- arrayType = (ArrayType) type;
- type = arrayType.getComponentType();
- checkSourceRange(type, "Map<String, Double>", source);
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79362
- */
- public void test0077() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0077", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput = "Type mismatch: cannot convert from Map[] to Map<String,Double>[][]";
- assertProblemsSize(compilationUnit, 1, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "java.util.Map<String, Double>[][]", source);
- assertEquals("wrong type", ASTNode.ARRAY_TYPE, type.getNodeType());
- ArrayType arrayType = (ArrayType) type;
- type = arrayType.getComponentType();
- checkSourceRange(type, "java.util.Map<String, Double>[]", source);
- assertEquals("wrong type", ASTNode.ARRAY_TYPE, type.getNodeType());
- arrayType = (ArrayType) type;
- type = arrayType.getComponentType();
- checkSourceRange(type, "java.util.Map<String, Double>", source);
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79460
- */
- public void test0078() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X<T> {\n" +
- " String foo(int i) { return /*start*/Integer.toString(i)/*end*/;}" +
- "}",
- this.workingCopy);
- IFunctionBinding methodBinding = ((FunctionInvocation) node).resolveMethodBinding();
- assertFalse("Is a raw method", methodBinding.isRawMethod());
- assertFalse("Is a parameterized method", methodBinding.isParameterizedMethod());
- assertFalse("Is a generic method", methodBinding.isGenericMethod());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79460
- */
- public void test0079() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X {\n" +
- " \n" +
- " /*start*/<T extends A> T foo(T t) {\n" +
- " return t;\n" +
- " }/*end*/\n" +
- " public static void main(String[] args) {\n" +
- " new X().bar();\n" +
- " }\n" +
- " void bar() {\n" +
- " B b = foo(new B());\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "class A {}\n" +
- "class B extends A {}\n",
- this.workingCopy);
- IFunctionBinding methodBinding = ((FunctionDeclaration) node).resolveBinding();
- assertFalse("Is a raw method", methodBinding.isRawMethod());
- assertFalse("Is a parameterized method", methodBinding.isParameterizedMethod());
- assertTrue("Not a generic method", methodBinding.isGenericMethod());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79460
- */
- public void test0080() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X {\n" +
- " \n" +
- " <T extends A> T foo(T t) {\n" +
- " return t;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " new X().bar();\n" +
- " }\n" +
- " void bar() {\n" +
- " B b = /*start*/foo(new B())/*end*/;\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "class A {}\n" +
- "class B extends A {}\n",
- this.workingCopy);
- IFunctionBinding methodBinding = ((FunctionInvocation) node).resolveMethodBinding();
- assertFalse("Is a raw method", methodBinding.isRawMethod());
- assertTrue("Not a parameterized method", methodBinding.isParameterizedMethod());
- assertFalse("Is a generic method", methodBinding.isGenericMethod());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79460
- */
- public void test0081() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0081", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput =
- "Class is a raw type. References to generic type Class<T> should be parameterized\n" +
- "Class is a raw type. References to generic type Class<T> should be parameterized\n" +
- "Type safety: The method foo(Object) belongs to the raw type Y. References to generic type Y<T> should be parameterized\n" +
- "Y is a raw type. References to generic type Y<T> should be parameterized";
- assertProblemsSize(compilationUnit, 4, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
- assertEquals("Not a method declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding();
- assertEquals("Wrong name", "foo", methodBinding.getName());
- assertTrue("Not a raw method", methodBinding.isRawMethod());
- assertFalse("Is a parameterized method", methodBinding.isParameterizedMethod());
- assertFalse("Is a generic method", methodBinding.isGenericMethod());
- assertFalse("Doesn't override itself", methodBinding.overrides(methodBinding));
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78183
- */
- public void test0082() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0082", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput =
- "Gen is a raw type. References to generic type Gen<X> should be parameterized\n" +
- "Gen.Inn is a raw type. References to generic type Gen<X>.Inn should be parameterized";
- assertProblemsSize(compilationUnit, 2, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong name", "Gen", typeBinding.getName());
- assertEquals("Wrong name", "test0082.Gen", typeBinding.getQualifiedName());
- assertTrue("Not a class", typeBinding.isClass());
- assertTrue("Not a generic type", typeBinding.isGenericType());
- assertTrue("Not a top level", typeBinding.isTopLevel());
-
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a member type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong name", "Inn", typeBinding.getName());
- assertEquals("Wrong name", "test0082.Gen.Inn", typeBinding.getQualifiedName());
- assertTrue("Not a class", typeBinding.isClass());
- assertTrue("Not a member", typeBinding.isMember());
- assertTrue("Not a nested class", typeBinding.isNested());
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- typeBinding = fieldDeclaration.getType().resolveBinding();
- assertEquals("Wrong name", "Gen<String>", typeBinding.getName());
- assertEquals("Wrong name", "test0082.Gen<java.lang.String>", typeBinding.getQualifiedName());
- assertTrue("Not a class", typeBinding.isClass());
- assertTrue("Not a parameterized type", typeBinding.isParameterizedType());
- assertTrue("Not a toplevel", typeBinding.isTopLevel());
-
- node = getASTNode(compilationUnit, 0, 2);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- typeBinding = fieldDeclaration.getType().resolveBinding();
- assertEquals("Wrong name", "Inn", typeBinding.getName());
- assertEquals("Wrong name", "test0082.Gen<java.lang.String>.Inn", typeBinding.getQualifiedName());
- assertTrue("Not a class", typeBinding.isClass());
- assertTrue("Not a member", typeBinding.isMember());
- assertTrue("Not a nested class", typeBinding.isNested());
- assertFalse("Is parameterized", typeBinding.isParameterizedType());
-
- node = getASTNode(compilationUnit, 0, 3);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- typeBinding = fieldDeclaration.getType().resolveBinding();
- assertEquals("Wrong name", "Gen", typeBinding.getName());
- assertEquals("Wrong name", "test0082.Gen", typeBinding.getQualifiedName());
- assertTrue("Not a class", typeBinding.isClass());
- assertTrue("Not a raw type", typeBinding.isRawType());
- assertTrue("Not a toplevel", typeBinding.isTopLevel());
-
- node = getASTNode(compilationUnit, 0, 4);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- typeBinding = fieldDeclaration.getType().resolveBinding();
- assertEquals("Wrong name", "Inn", typeBinding.getName());
- assertEquals("Wrong name", "test0082.Gen.Inn", typeBinding.getQualifiedName());
- assertTrue("Not a class", typeBinding.isClass());
- assertTrue("Not a member", typeBinding.isMember());
- assertTrue("Not a nested type", typeBinding.isNested());
- assertFalse("Is parameterized", typeBinding.isParameterizedType());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79544
- */
- public void test0083() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0083", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- ITypeBinding typeBinding = fieldDeclaration.getType().resolveBinding();
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- ITypeBinding typeBinding2 = fieldDeclaration.getType().resolveBinding();
-
- node = getASTNode(compilationUnit, 0, 2);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- ITypeBinding typeBinding3 = fieldDeclaration.getType().resolveBinding();
-
- node = getASTNode(compilationUnit, 0, 3);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- ITypeBinding typeBinding4 = fieldDeclaration.getType().resolveBinding();
-
- assertFalse("Binding are equals", typeBinding.isEqualTo(typeBinding2));
- assertFalse("Binding are equals", typeBinding.isEqualTo(typeBinding3));
- assertFalse("Binding are equals", typeBinding.isEqualTo(typeBinding4));
- assertFalse("Binding are equals", typeBinding2.isEqualTo(typeBinding3));
- assertFalse("Binding are equals", typeBinding2.isEqualTo(typeBinding4));
- assertFalse("Binding are equals", typeBinding3.isEqualTo(typeBinding4));
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79612
- */
- public void test0084() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0084", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- ITypeBinding typeBinding = fieldDeclaration.getType().resolveBinding();
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- ITypeBinding typeBinding2 = fieldDeclaration.getType().resolveBinding();
-
- assertFalse("Binding are equals", typeBinding.isEqualTo(typeBinding2));
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79609
- */
- public void test0085() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0085", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List typeParameters = methodDeclaration.typeParameters();
- assertEquals("wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- IBinding binding = typeParameter.resolveBinding();
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding = (ITypeBinding) binding;
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- typeParameters = methodDeclaration.typeParameters();
- assertEquals("wrong size", 1, typeParameters.size());
- typeParameter = (TypeParameter) typeParameters.get(0);
- binding = typeParameter.resolveBinding();
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding2 = (ITypeBinding) binding;
-
- assertFalse("Binding are equals", typeBinding.isEqualTo(typeBinding2));
- }
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79512
- */
- public void test0086() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X {\n" +
- " \n" +
- "public Object foo() {\n" +
- " return /*start*/X.class/*end*/;\n" +
- " }" +
- "}\n" +
- "\n" +
- "class A {}\n" +
- "class B extends A {}\n",
- this.workingCopy);
- TypeLiteral typeLiteral = (TypeLiteral) node;
- ITypeBinding typeBinding = typeLiteral.resolveTypeBinding();
- assertEquals("Wrong name", "java.lang.Class<p.X>", typeBinding.getQualifiedName());
- assertEquals("Wrong name", "Class<X>", typeBinding.getName());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79775
- */
- public void test0087() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- buildAST(
- "package p;\n" +
- "public class X<T1> {\n" +
- " public <M1> X() {\n" +
- " }\n" +
- " class Y<T2> {\n" +
- " public <M2> Y() {\n" +
- " }\n" +
- " }\n" +
- " void foo() {\n" +
- " new <Object>X<Object>().new <Object>Y<Object>();\n" +
- " }\n" +
- "}\n",
- this.workingCopy);
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=79690
- */
- public void test0088() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0088", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Wrong name", "E", typeBinding.getName());
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- ASTNode node2 = compilationUnit.findDeclaringNode(typeBinding);
- assertNotNull("No declaring node", node2);
- ASTNode node3 = compilationUnit.findDeclaringNode(typeBinding.getKey());
- assertNotNull("No declaring node", node3);
- assertTrue("Nodes don't match", node2.subtreeMatch(new ASTMatcher(), node3));
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List typeParameters = methodDeclaration.typeParameters();
- assertEquals("Wrong size", 1, typeParameters.size());
- TypeParameter typeParameter = (TypeParameter) typeParameters.get(0);
- assertTrue("Nodes don't match", typeParameter.subtreeMatch(new ASTMatcher(), node3));
- assertTrue("Nodes don't match", typeParameter.subtreeMatch(new ASTMatcher(), node2));
- }
-
- /*
- * Ensures that a parameterized method binding (with a wildcard parameter) doesn't throw a NPE when computing its binding key.
- * (regression test for 79967 NPE in WildcardBinding.signature with Mark Occurrences in Collections.class)
- */
- public void test0089() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X<T> {\n" +
- " void foo() {\n" +
- " }\n" +
- " void bar(X<?> x) {\n" +
- " /*start*/x.foo()/*end*/;\n"+
- " }\n" +
- "}",
- this.workingCopy);
- IBinding binding = ((FunctionInvocation) node).resolveMethodBinding();
- assertBindingKeyEquals(
- "Lp/X<!Lp/X;*75;>;.foo()V",
- binding.getKey());
- }
-
- /*
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=80021
- */
- public void test0090() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode result = buildAST(
- "package p;\n" +
- "public class X {\n" +
- " public void foo() {}\n" +
- " public void bar(X x, int f) {\n" +
- " x.foo();\n" +
- " }\n" +
- "}",
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- compilationUnit.accept(new ASTVisitor() {
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration)
- */
- public boolean visit(SingleVariableDeclaration node) {
- IVariableBinding binding = node.resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement javaElement = binding.getJavaElement();
- assertNotNull("No java element", javaElement);
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment)
- */
- public boolean visit(VariableDeclarationFragment node) {
- IVariableBinding binding = node.resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement javaElement = binding.getJavaElement();
- assertNotNull("No java element", javaElement);
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.FieldAccess)
- */
- public boolean visit(FieldAccess node) {
- IVariableBinding binding = node.resolveFieldBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement javaElement = binding.getJavaElement();
- assertNotNull("No java element", javaElement);
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperFieldAccess)
- */
- public boolean visit(SuperFieldAccess node) {
- IVariableBinding binding = node.resolveFieldBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement javaElement = binding.getJavaElement();
- assertNotNull("No java element", javaElement);
- return false;
- }
- });
- }
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=80960
- */
- public void test0092() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "import java.util.*;\n" +
- "public class X {\n" +
- " public enum Rank { DEUCE, THREE, FOUR, FIVE, SIX,\n" +
- " SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }\n" +
- "\n" +
- " //public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }\n" +
- " public enum Suit{\n" +
- "\n" +
- " private X(int rank, int suit) { \n" +
- " }\n" +
- " \n" +
- " private static final List<X> protoDeck = new ArrayList<X>();\n" +
- " \n" +
- " public static ArrayList<X> newDeck() {\n" +
- " return new ArrayList<X>(protoDeck); // Return copy of prototype deck\n" +
- " }\n" +
- "}",
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=81023
- */
- public void test0093() throws JavaScriptModelException {
- String contents =
- "public class Test {\n" +
- " public <U> Test(U u) {\n" +
- " }\n" +
- "\n" +
- " void bar() {\n" +
- " new <String> Test(null) {};\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/Test.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- checkSourceRange(expression, "new <String> Test(null) {}", contents.toCharArray());
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- IJavaScriptElement element = typeBinding.getJavaElement();
- assertNotNull("No java element", element);
- }
-
-
- /*
- * Ensures that resolving a generic method with a non existing parameter type doesn't throw a NPE when computing its binding key.
- * (regression test for 81134 [dom] [5.0] NPE when creating AST
- */
- public void test0095() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/<T> void foo(NonExisting arg) {\n" +
- " }/*end*/\n" +
- "}",
- this.workingCopy,
- false);
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertEquals(
- null,
- binding);
- }
-
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82140
- */
- public void test0098() throws JavaScriptModelException {
- String contents =
- "class X {\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List modifiers = typeDeclaration.modifiers();
- assertEquals("Wrong size", 0, modifiers.size());
- }
-
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=68823
- */
- public void test0101() throws JavaScriptModelException {
- String contents =
- "public class X{\n" +
- " public void foo() {\n" +
- " assert (true): (\"hello\");\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an assert statement", ASTNode.ASSERT_STATEMENT, node.getNodeType());
- AssertStatement assertStatement = (AssertStatement) node;
- final char[] source = contents.toCharArray();
- checkSourceRange(assertStatement.getExpression(), "(true)", source);
- checkSourceRange(assertStatement.getMessage(), "(\"hello\")", source);
- checkSourceRange(assertStatement, "assert (true): (\"hello\");", source);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82670
- */
- public void test0102() throws JavaScriptModelException {
- String contents =
- "import java.util.HashMap;\n" +
- "\n" +
- "public class X {\n" +
- " Object o= new HashMap<?, ?>[0];\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(fragment, "o= new HashMap<?, ?>[0]", contents.toCharArray());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82985
- */
- public void test0103() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0103", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- List imports = compilationUnit.imports();
- assertEquals("Wrong size", 2, imports.size());
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- Name name = importDeclaration.getName();
- binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) name;
- SimpleName simpleName = qualifiedName.getName();
- binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
-
- Name name2 = qualifiedName.getQualifier();
- binding = name2.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
-
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name2.getNodeType());
- qualifiedName = (QualifiedName) name2;
- simpleName = qualifiedName.getName();
- binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
-
- Name name3 = qualifiedName.getQualifier();
- binding = name3.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind());
-
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name3.getNodeType());
-
- importDeclaration = (ImportDeclaration) imports.get(1);
- binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- assertFalse("Not a single name import", importDeclaration.isOnDemand());
- name = importDeclaration.getName();
- binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind());
-
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- qualifiedName = (QualifiedName) name;
- simpleName = qualifiedName.getName();
- binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind());
-
- name2 = qualifiedName.getQualifier();
- binding = name2.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name2.getNodeType());
- qualifiedName = (QualifiedName) name2;
- simpleName = qualifiedName.getName();
- binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
-
- name2 = qualifiedName.getQualifier();
- binding = name2.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind());
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name2.getNodeType());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82985
- */
- public void test0104() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0104", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- List imports = compilationUnit.imports();
- assertEquals("Wrong size", 1, imports.size());
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- int kind = binding.getKind();
- assertTrue("Wrong type", kind == IBinding.VARIABLE || kind == IBinding.METHOD);
- }
-
-
-
-
-
- /*
- * Ensures that the type declaration of a top level type binding is correct.
- */
- public void test0110() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- TypeDeclaration type = (TypeDeclaration) buildAST(
- "/*start*/public class X {\n" +
- "}/*end*/",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getTypeDeclaration();
- assertBindingEquals(
- "LX;",
- binding);
- }
-
- /*
- * Ensures that the type declaration of a generic type binding is correct.
- */
- public void test0111() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- TypeDeclaration type = (TypeDeclaration) buildAST(
- "/*start*/public class X<E> {\n" +
- "}/*end*/",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getTypeDeclaration();
- assertBindingEquals(
- "LX<TE;>;",
- binding);
- }
-
- /*
- * Ensures that the type declaration of a parameterized type binding is correct.
- */
- public void test0112() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " /*start*/X<String>/*end*/ field;\n" +
- "}",
- this.workingCopy,
- false);
- ITypeBinding binding = type.resolveBinding().getTypeDeclaration();
- assertBindingEquals(
- "LX<TE;>;",
- binding);
- }
-
- /*
- * Ensures that the type declaration of a raw type binding is correct.
- */
- public void test0113() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " /*start*/X/*end*/ field;\n" +
- "}",
- this.workingCopy,
- false);
- ITypeBinding binding = type.resolveBinding().getTypeDeclaration();
- assertBindingEquals(
- "LX<TE;>;",
- binding);
- }
-
- /*
- * Ensures that the type declaration of a wildcard type binding is correct.
- */
- public void test0114() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " X</*start*/? extends String/*end*/> field;\n" +
- "}",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getTypeDeclaration();
- assertBindingEquals(
- "LX;+Ljava/lang/String;",
- binding);
- }
-
- /*
- * Ensures that the type declaration of a type variable binding is correct.
- */
- public void test0115() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- TypeParameter type = (TypeParameter) buildAST(
- "public class X</*start*/E/*end*/> {\n" +
- "}",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getTypeDeclaration();
- assertBindingEquals(
- "LX;:TE;",
- binding);
- }
-
- /*
- * Ensures that the erasure of a top level type binding is correct.
- */
- public void test0116() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- TypeDeclaration type = (TypeDeclaration) buildAST(
- "/*start*/public class X {\n" +
- "}/*end*/",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getErasure();
- assertBindingEquals(
- "LX;",
- binding);
- }
-
- /*
- * Ensures that the erasure of a generic type binding is correct.
- */
- public void test0117() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- TypeDeclaration type = (TypeDeclaration) buildAST(
- "/*start*/public class X<E> {\n" +
- "}/*end*/",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getErasure();
- assertBindingEquals(
- "LX<TE;>;",
- binding);
- }
-
- /*
- * Ensures that the erasure of a parameterized type binding is correct.
- */
- public void test0118() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " /*start*/X<String>/*end*/ field;\n" +
- "}",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getErasure();
- assertBindingEquals(
- "LX<TE;>;",
- binding);
- }
-
- /*
- * Ensures that the erasure of a raw type binding is correct.
- */
- public void test0119() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " /*start*/X/*end*/ field;\n" +
- "}",
- this.workingCopy,
- false);
- ITypeBinding binding = type.resolveBinding().getErasure();
- assertBindingEquals(
- "LX<TE;>;",
- binding);
- }
-
- /*
- * Ensures that the erasure of a wildcard type binding is correct.
- */
- public void test0120() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " X</*start*/? extends String/*end*/> field;\n" +
- "}",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getErasure();
- assertBindingEquals(
- "Ljava/lang/String;",
- binding);
- }
-
- /*
- * Ensures that the erasure of a type variable binding is correct.
- */
- public void test0121() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- TypeParameter type = (TypeParameter) buildAST(
- "public class X</*start*/E/*end*/> {\n" +
- "}",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding().getErasure();
- assertBindingEquals(
- "Ljava/lang/Object;",
- binding);
- }
-
- /*
- * Ensures that the declaration of a non generic method binding is correct.
- */
- public void test0122() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- FunctionDeclaration method = (FunctionDeclaration) buildAST(
- "public class X {\n" +
- " /*start*/void foo() {\n" +
- " }/*end*/\n" +
- "}",
- this.workingCopy);
- IFunctionBinding binding = method.resolveBinding().getMethodDeclaration();
- assertBindingEquals(
- "LX;.foo()V",
- binding);
- }
-
- /*
- * Ensures that the declaration of a generic method binding is correct.
- */
- public void test0123() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- FunctionDeclaration method = (FunctionDeclaration) buildAST(
- "public class X {\n" +
- " /*start*/<E> void foo() {\n" +
- " }/*end*/\n" +
- "}",
- this.workingCopy);
- IFunctionBinding binding = method.resolveBinding().getMethodDeclaration();
- assertBindingEquals(
- "LX;.foo<E:Ljava/lang/Object;>()V",
- binding);
- }
-
- /*
- * Ensures that the declaration of a parameterized method binding is correct.
- */
- public void test0124() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- FunctionInvocation method = (FunctionInvocation) buildAST(
- "public class X {\n" +
- " <E> void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " /*start*/this.<String>foo()/*end*/;\n" +
- " }\n" +
- "}",
- this.workingCopy);
- IFunctionBinding binding = method.resolveMethodBinding().getMethodDeclaration();
- assertBindingEquals(
- "LX;.foo<E:Ljava/lang/Object;>()V",
- binding);
- }
-
- /*
- * Ensures that the declaration of a raw method binding is correct.
- */
- public void test0125() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- FunctionInvocation method = (FunctionInvocation) buildAST(
- "public class X {\n" +
- " <E> void foo() {\n" +
- " }\n" +
- " void bar() {\n" +
- " /*start*/this.foo()/*end*/;\n" +
- " }\n" +
- "}",
- this.workingCopy);
- IFunctionBinding binding = method.resolveMethodBinding().getMethodDeclaration();
- assertBindingEquals(
- "LX;.foo<E:Ljava/lang/Object;>()V",
- binding);
- }
-
- /*
- * Ensures that the key for a parameterized type binding with an extends wildcard bounded to a type variable
- * is correct.
- */
- public void test0126() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- Type type = (Type) buildAST(
- "public class X<E> {\n" +
- " /*start*/Class<? extends E>/*end*/ field;\n" +
- "}",
- this.workingCopy);
- ITypeBinding binding = type.resolveBinding();
- assertBindingEquals(
- "Ljava/lang/Class<Ljava/lang/Class;+LX;:TE;>;",
- binding);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=83817
- public void test0127() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "class X<T> {\n" +
- " public void method(Number num) {}\n" +
- "}\n" +
- "\n" +
- "class Z {\n" +
- " void test() {\n" +
- " new X<String>().method(0);\n" +
- " new X<Integer>().method(1);\n" +
- " }\n" +
- "}",
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding();
- node = getASTNode(compilationUnit, 1, 0, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- methodInvocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding2 = methodInvocation.resolveMethodBinding();
- assertFalse("Keys are equals", methodBinding.getKey().equals(methodBinding2.getKey()));
- assertFalse("bindings are equals", methodBinding.isEqualTo(methodBinding2));
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84064
- public void test0128() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "class X {\n" +
- " static X x;\n" +
- "\n" +
- " static class G extends E {\n" +
- " public G() {\n" +
- " x.<String> super();\n" +
- " }\n" +
- " }\n" +
- "\n" +
- " class E {\n" +
- " public <T> E() {\n" +
- " }\n" +
- " }\n" +
- "}";
- final char[] source = contents.toCharArray();
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- Block body = methodDeclaration.getBody();
- assertNotNull("No body", body);
- List statements = body.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement = (Statement) statements.get(0);
- assertEquals("Not a super constructor invocation", ASTNode.SUPER_CONSTRUCTOR_INVOCATION, statement.getNodeType());
- SuperConstructorInvocation constructorInvocation = (SuperConstructorInvocation) statement;
- checkSourceRange(constructorInvocation, "x.<String> super();", source);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84064
- public void test0129() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "class X {\n" +
- " static X x;\n" +
- " static class G extends E {\n" +
- " public <T> G() {\n" +
- " x.<String> this();\n" +
- " }\n" +
- " }\n" +
- " static class E {\n" +
- " public <T> E() {\n" +
- " }\n" +
- " }\n" +
- "}";
- final char[] source = contents.toCharArray();
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- String expectedProblem = "Illegal enclosing instance specification for type X.G";
- assertProblemsSize(compilationUnit, 1, expectedProblem);
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- Block body = methodDeclaration.getBody();
- assertNotNull("No body", body);
- List statements = body.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement = (Statement) statements.get(0);
- assertEquals("Not a constructor invocation", ASTNode.CONSTRUCTOR_INVOCATION, statement.getNodeType());
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) statement;
- checkSourceRange(constructorInvocation, "x.<String> this();", source);
- assertTrue("Node is not malformed", isMalformed(constructorInvocation));
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=78934
- public void test0130() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "class Outer<A> {\n" +
- " class Inner {\n" +
- " class InnerInner<C> {\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "public class X {\n" +
- " void foo() {\n" +
- " Outer<String>.Inner.InnerInner<Integer> in = new Outer<String>().new Inner(). new InnerInner<Integer>();\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- ITypeBinding typeBinding = parameterizedType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 1", "Outer<java.lang.String>.Inner.InnerInner<java.lang.Integer>", typeBinding.getQualifiedName());
- type = parameterizedType.getType();
- assertTrue("Not a qualified type", type.isQualifiedType());
- QualifiedType qualifiedType = (QualifiedType) type;
- typeBinding = qualifiedType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 2", "Outer<java.lang.String>.Inner.InnerInner<java.lang.Integer>", typeBinding.getQualifiedName());
- SimpleName simpleName = qualifiedType.getName();
- typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 3", "Outer<java.lang.String>.Inner.InnerInner<java.lang.Integer>", typeBinding.getQualifiedName());
- type = qualifiedType.getQualifier();
- assertTrue("Not a qualified type", type.isQualifiedType());
- qualifiedType = (QualifiedType) type;
- typeBinding = qualifiedType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 4", "Outer<java.lang.String>.Inner", typeBinding.getQualifiedName());
- simpleName = qualifiedType.getName();
- typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 5", "Outer.Inner", typeBinding.getQualifiedName());
- type = qualifiedType.getQualifier();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- parameterizedType = (ParameterizedType) type;
- typeBinding = parameterizedType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 6", "Outer<java.lang.String>", typeBinding.getQualifiedName());
- type = parameterizedType.getType();
- assertTrue("Not a simple type", type.isSimpleType());
- SimpleType simpleType = (SimpleType) type;
- typeBinding = simpleType.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 7", "Outer<java.lang.String>", typeBinding.getQualifiedName());
- Name name = simpleType.getName();
- assertTrue("Not a simple name", name.isSimpleName());
- simpleName = (SimpleName) name;
- typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong qualified name 8", "Outer", typeBinding.getQualifiedName());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84140
- public void test0131() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public void bar(String... args){\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- assertTrue("Not a var args", singleVariableDeclaration.isVarargs());
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String", contents);
- assertTrue("Not a simple type", type.isSimpleType());
- checkSourceRange(type, "String", contents);
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertFalse("An array", typeBinding.isArray());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- ITypeBinding[] parameterTypes = methodBinding.getParameterTypes();
- ITypeBinding parameterType = parameterTypes[0];
- assertTrue("Not an array binding", parameterType.isArray());
- assertTrue("Not equals", parameterType.getComponentType() == parameterType.getElementType());
- assertEquals("wrong dimension", 1, parameterType.getDimensions());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84140
- public void test0132() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public void bar(String[]... args[]){\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 1, "Extended dimensions are illegal for a variable argument");
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- assertTrue("Not a var args", singleVariableDeclaration.isVarargs());
- assertTrue("Not a malformed node", isMalformed(singleVariableDeclaration));
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String[]", contents);
- assertTrue("Not an array type", type.isArrayType());
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertTrue("Not an array", typeBinding.isArray());
- assertEquals("wrong dimensions", 1, typeBinding.getDimensions());
- ArrayType arrayType = (ArrayType) type;
- assertEquals("Wrong dimension", 1, arrayType.getDimensions());
- type = arrayType.getComponentType();
- assertTrue("Not a simple type", type.isSimpleType());
- checkSourceRange(type, "String", contents);
- assertEquals("Wrong extra dimension", 1, singleVariableDeclaration.getExtraDimensions());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- ITypeBinding[] parameterTypes = methodBinding.getParameterTypes();
- ITypeBinding parameterType = parameterTypes[0];
- assertTrue("Not an array binding", parameterType.isArray());
- assertEquals("wrong dimension", 3, parameterType.getDimensions());
- ITypeBinding componentType = parameterType.getComponentType();
- assertEquals("wrong dimension", 2, componentType.getDimensions());
- assertTrue("Not equal", parameterType.getElementType() == componentType.getElementType());
- ITypeBinding componentType2 = componentType.getComponentType();
- assertEquals("wrong dimension", 1, componentType2.getDimensions());
- assertTrue("Not equal", parameterType.getElementType() == componentType2.getElementType());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84181
- public void test0133() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.Vector;\n" +
- "\n" +
- "public class X {\n" +
- " void k() {\n" +
- " Vector v2 = /*start*/new Vector()/*end*/;\n" +
- " Vector v3 = new Vector();\n" +
- "\n" +
- " v3.add(\"fff\");\n" +
- " v2.add(v3);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a class instance creation unit", ASTNode.CLASS_INSTANCE_CREATION, node.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) node;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertEquals("wrong qualified name", "java.util.Vector", typeBinding.getQualifiedName());
- assertTrue("Not a raw type", typeBinding.isRawType());
- assertFalse("From source", typeBinding.isFromSource());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84181
- public void test0134() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.Vector;\n" +
- "\n" +
- "public class X {\n" +
- " void k() {\n" +
- " Vector v2 = /*start*/new Vector<String>()/*end*/;\n" +
- "\n" +
- " v2.add(\"\");\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a class instance creation unit", ASTNode.CLASS_INSTANCE_CREATION, node.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) node;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertEquals("wrong qualified name", "java.util.Vector<java.lang.String>", typeBinding.getQualifiedName());
- assertTrue("Not a parameterized type", typeBinding.isParameterizedType());
- assertFalse("From source", typeBinding.isFromSource());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=78934
- public void test0135() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class X {\n" +
- " public static X instance= new X();\n" +
- "\n" +
- " int s;\n" +
- "\n" +
- " int f() {\n" +
- " System.out.println(X.instance.s + 1);\n" +
- " return 1;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- compilationUnit.accept(new ASTVisitor() {
- public boolean visit(QualifiedName qualifiedName) {
- ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- return true;
- }
- });
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=78934
- public void test0136() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class X {\n" +
- " public static X instance= new X();\n" +
- " public X instance2 = new X();\n" +
- " int s;\n" +
- " int f() {\n" +
- " System.out.println(X.instance.instance2.s + 1);\n" +
- " return 1;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- compilationUnit.accept(new ASTVisitor() {
- public boolean visit(QualifiedName qualifiedName) {
- ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- return true;
- }
- });
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79696
- */
- public void test0137() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0137", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Wrong node", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- type = parameterizedType.getType();
- assertTrue("Not a parameterized type", type.isSimpleType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.isSimpleName());
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertEquals("Wrong name", "test0137.Source", typeBinding.getQualifiedName());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=81544
- public void test0138() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "class X {\n" +
- " java.util.List<URL> method(java.util.List<URL> list) {\n" +
- " java.util.List<URL> url= new java.util.List<URL>();\n" +
- " return url;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 4,
- "URL cannot be resolved to a type\n" +
- "URL cannot be resolved to a type\n" +
- "URL cannot be resolved to a type\n" +
- "URL cannot be resolved to a type");
- compilationUnit.accept(new ASTVisitor() {
- public boolean visit(ParameterizedType type) {
- checkSourceRange(type, "java.util.List<URL>", contents);
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- return true;
- }
- });
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84358
- */
- public void test0139() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0139", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 1, "The type test0139a.C is not visible");
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Wrong node", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("Not a parameterized type", type.isParameterizedType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- type = parameterizedType.getType();
- assertTrue("Not a parameterized type", type.isSimpleType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertEquals("wrong qualified name", "test0139a.C", typeBinding.getQualifiedName());
- SimpleName simpleName = qualifiedName.getName();
- binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.TYPE, binding.getKind());
- typeBinding = (ITypeBinding) binding;
- assertEquals("wrong qualified name", "test0139a.C", typeBinding.getQualifiedName());
- name = qualifiedName.getQualifier();
- assertEquals("Not a simpleName", ASTNode.SIMPLE_NAME, name.getNodeType());
- binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("wrong type", IBinding.PACKAGE, binding.getKind());
- IPackageBinding packageBinding = (IPackageBinding) binding;
- assertEquals("wrong name", "test0139a", packageBinding.getName());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=83100
- public void test0141() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "public class X<T> {\n" +
- " int x;\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(new X<String>().x);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertFalse("Not a parameter", variableBinding.isParameter());
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression2 = (Expression) arguments.get(0);
- assertEquals("Not a field access", ASTNode.FIELD_ACCESS, expression2.getNodeType());
- FieldAccess fieldAccess = (FieldAccess) expression2;
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertFalse("Not a parameter", variableBinding2.isParameter());
- assertFalse("Bindings are not equals", variableBinding.isEqualTo(variableBinding2));
- IVariableBinding variableBinding3 = variableBinding2.getVariableDeclaration();
- assertTrue("Bindings are equals", variableBinding.isEqualTo(variableBinding3));
- node = compilationUnit.findDeclaringNode(variableBinding2);
- assertNotNull("No declaring node", node);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=83100
- public void test0142() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "public class X<T> {\n" +
- " public static void main(String[] args) {\n" +
- " int x = 0;\n" +
- " System.out.println(x);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- assertEquals("Wrong name", "x", fragment.getName().getIdentifier());
- IVariableBinding variableBinding = fragment.resolveBinding();
- IVariableBinding variableBinding2 = variableBinding.getVariableDeclaration();
- assertFalse("Not a parameter", variableBinding.isParameter());
- assertFalse("Not a parameter", variableBinding2.isParameter());
- assertTrue("Bindings are equals", variableBinding.isEqualTo(variableBinding2));
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84140
- public void test0143() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public void bar(String[]... args){\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- assertTrue("Not a var args", singleVariableDeclaration.isVarargs());
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String[]", contents);
- assertTrue("Not an array type", type.isArrayType());
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertTrue("Not an array", typeBinding.isArray());
- assertEquals("wrong dimensions", 1, typeBinding.getDimensions());
- ArrayType arrayType = (ArrayType) type;
- assertEquals("Wrong dimension", 1, arrayType.getDimensions());
- type = arrayType.getComponentType();
- assertTrue("Not a simple type", type.isSimpleType());
- checkSourceRange(type, "String", contents);
- assertEquals("Wrong extra dimension", 0, singleVariableDeclaration.getExtraDimensions());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- ITypeBinding[] parameterTypes = methodBinding.getParameterTypes();
- ITypeBinding parameterType = parameterTypes[0];
- assertTrue("Not an array binding", parameterType.isArray());
- assertEquals("wrong dimension", 2, parameterType.getDimensions());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87171
- public void test0144() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<T> {\n" +
- " void foo(T t) {\n" +
- " System.out.println(t);\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "class Use {\n" +
- " public static void main(String[] args) {\n" +
- " X<String> i= null;\n" +
- " i.foo(\"Eclipse\");\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 1, 0, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding();
- node = compilationUnit.findDeclaringNode(methodBinding);
- assertNotNull("No declaring node", node);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87350
- public void test0145() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public enum X {\n" +
- " RED, GREEN(), BLUE(17), PINK(1) {/*anon*};\n" +
- " Color() {}\n" +
- " Color(int i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- String expectedErrors = "The constructor X(int) is undefined\n" +
- "The constructor X(int) is undefined\n" +
- "Unexpected end of comment";
- assertProblemsSize(compilationUnit, 3, expectedErrors);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87481
- public void test0146() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.Iterator;\n" +
- "public class X {\n" +
- " void doit() {\n" +
- " Iterator iter= (Iterator) null;\n" +
- " System.out.println(iter);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- String expectedProblems =
- "Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" +
- "Iterator is a raw type. References to generic type Iterator<E> should be parameterized";
- assertProblemsSize(compilationUnit, 2, expectedProblems);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertNotNull("No initializer", expression);
- assertEquals("Not a cast expression", ASTNode.CAST_EXPRESSION, expression.getNodeType());
- CastExpression castExpression = (CastExpression) expression;
- Type type = castExpression.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Wrong type", "java.util.Iterator", typeBinding.getQualifiedName());
- assertTrue("Not a raw type", typeBinding.isRawType());
- assertFalse("Is a generic type", typeBinding.isGenericType());
- assertFalse("Is a parameterized type", typeBinding.isParameterizedType());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87498
- public void test0147() throws CoreException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0147", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
-
-
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548
- public void test0152() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static final int CONST1 = 1;\n" +
- " public static final int CONST2 = 2;\n" +
- " public static void main(String[] args) {\n" +
- " int[] intTab = new int[] {2, 3};\n" +
- " for (int i : intTab) {\n" +
- " switch(i) {\n" +
- " case CONST1 :\n" +
- " System.out.println(\"1\");\n" +
- " break;\n" +
- " case CONST2 :\n" +
- " System.out.println(\"2\");\n" +
- " break;\n" +
- " default :\n" +
- " System.out.println(\"default\");\n" +
- " break;\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 3, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(2);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block);
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
- Statement statement = (Statement) statements.get(1);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, statement.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) statement;
- Statement statement2 = forStatement.getBody();
- assertEquals("Not a block", ASTNode.BLOCK, statement2.getNodeType());
- Block block2 = (Block) statement2;
- statements = block2.statements();
- assertEquals("Wrong size", 1, statements.size());
- statement = (Statement) statements.get(0);
- assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, statement.getNodeType());
- SwitchStatement switchStatement = (SwitchStatement) statement;
- statements = switchStatement.statements();
- assertEquals("Wrong size", 9, statements.size());
- statement = (Statement) statements.get(0);
- assertEquals("Not a switch case statement", ASTNode.SWITCH_CASE, statement.getNodeType());
- SwitchCase switchCase = (SwitchCase) statement;
- Expression expression = switchCase.getExpression();
- Object constant = expression.resolveConstantExpressionValue();
- assertNotNull("No constant", constant);
- assertEquals("Wrong value", "1", String.valueOf(constant));
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88841
- public void test0153() throws CoreException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0153", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0154() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " test(/*start*/1/*end*/);\n" +
- " }\n" +
- " public static void test(Integer i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a number literal", ASTNode.NUMBER_LITERAL, node.getNodeType());
- NumberLiteral literal = (NumberLiteral) node;
- assertTrue("Not boxed", literal.resolveBoxing());
- assertFalse("Is unboxed", literal.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0155() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static int bar() {return 1;}\n" +
- " public static void main(String[] s) {\n" +
- " test(/*start*/bar()/*end*/);\n" +
- " }\n" +
- " public static void test(Integer i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, node.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) node;
- assertTrue("Not boxed", methodInvocation.resolveBoxing());
- assertFalse("Is unboxed", methodInvocation.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0156() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " test(/*start*/new Integer(1)/*end*/);\n" +
- " }\n" +
- " public static void test(int i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, node.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) node;
- assertFalse("Is boxed", classInstanceCreation.resolveBoxing());
- assertTrue("Not unboxed", classInstanceCreation.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548
- public void test0157() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " test(/*start*/null/*end*/);\n" +
- " }\n" +
- " public static void test(Object o) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a null literal", ASTNode.NULL_LITERAL, node.getNodeType());
- NullLiteral nullLiteral = (NullLiteral) node;
- assertNull("Got a constant", nullLiteral.resolveConstantExpressionValue());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88548
- public void test0158() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " private static final String CONST = \"Hello World\";\n" +
- " public static void main(String[] s) {\n" +
- " System.out.println(/*start*/CONST/*end*/);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, node.getNodeType());
- SimpleName name = (SimpleName) node;
- assertNotNull("No constant", name.resolveConstantExpressionValue());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0159() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " test(/*start*/new Integer(1)/*end*/);\n" +
- " }\n" +
- " public static void test(Integer i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, node.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) node;
- assertFalse("Is boxed", classInstanceCreation.resolveBoxing());
- assertFalse("Is unboxed", classInstanceCreation.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0160() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " Y.test(1, new Integer(2), -3);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " public static void test(int ... i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong size", 3, arguments.size());
- Expression argument = (Expression) arguments.get(0);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertFalse("Is unboxed", argument.resolveUnboxing());
- argument = (Expression) arguments.get(1);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertTrue("Not unboxed", argument.resolveUnboxing());
- argument = (Expression) arguments.get(2);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertFalse("Is unboxed", argument.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0161() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " new Y().test(new Integer(1), 1);\n" +
- " new Y().test(1, new Integer(1));\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " void test(Integer i, int j) { System.out.print(1); }\n" +
- " void test(int i, Integer j) { System.out.print(2); }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong size", 2, arguments.size());
- Expression argument = (Expression) arguments.get(0);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertFalse("Is unboxed", argument.resolveUnboxing());
- argument = (Expression) arguments.get(1);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertFalse("Is unboxed", argument.resolveUnboxing());
- getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- expressionStatement = (ExpressionStatement) node;
- expression = expressionStatement.getExpression();
- assertEquals("Not method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- methodInvocation = (FunctionInvocation) expression;
- arguments = methodInvocation.arguments();
- assertEquals("Wrong size", 2, arguments.size());
- argument = (Expression) arguments.get(0);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertFalse("Is unboxed", argument.resolveUnboxing());
- argument = (Expression) arguments.get(1);
- assertFalse("Is boxed", argument.resolveBoxing());
- assertFalse("Is unboxed", argument.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=87173
- public void test0162() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] s) {\n" +
- " int i = Y.test();\n" +
- " System.out.print(i);\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " public static Byte test() { return new Byte((byte) 1); }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertFalse("Is boxed", expression.resolveBoxing());
- assertTrue("Not unboxed", expression.resolveUnboxing());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86580
- public void test0163() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<T>{\n" +
- " void f(T t){}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- final ITypeBinding declaringClass = typeBinding.getDeclaringClass();
- assertNotNull("No declaring class", declaringClass);
- assertTrue("Not a generic class", declaringClass.isGenericType());
- assertEquals("Wrong name", "X", declaringClass.getName());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86580
- public void test0164() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class X {\n" +
- " <U> void foo(U u) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Type type = singleVariableDeclaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- final IFunctionBinding methodBinding = typeBinding.getDeclaringMethod();
- assertNotNull("No declaring method", methodBinding);
- assertEquals("Wrong name", "foo", methodBinding.getName());
- assertTrue("Not a generic method", methodBinding.isGenericMethod());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86580
- public void test0165() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class X {\n" +
- " <U> void foo(U u) {\n" +
- " class C {}\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDeclaration = statement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertTrue("Not a local type", typeBinding.isLocal());
- ITypeBinding declaringClass = typeBinding.getDeclaringClass();
- assertNotNull("No declaring class", declaringClass);
- IFunctionBinding declaringMethod = typeBinding.getDeclaringMethod();
- assertNotNull("No declaring method", declaringMethod);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86580
- public void test0166() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class X {\n" +
- " {\n" +
- " class C {}\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDeclaration = statement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertTrue("Not a local type", typeBinding.isLocal());
- ITypeBinding declaringClass = typeBinding.getDeclaringClass();
- assertNotNull("No declaring class", declaringClass);
- IFunctionBinding declaringMethod = typeBinding.getDeclaringMethod();
- assertNull("No declaring method", declaringMethod);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88841
- public void test0167() throws CoreException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0167", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- ASTNode node = getASTNode(compilationUnit, 1, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 4, parameters.size());
- SingleVariableDeclaration param = (SingleVariableDeclaration)parameters.get(3);
- Type t = param.getType();
- String typeName = ((SimpleType)t).getName().getFullyQualifiedName();
-
- IType[] types = sourceUnit.getTypes();
- assertEquals("wrong size", 2, types.length);
- IType mainType = types[1];
- String[][] typeMatches = mainType.resolveType( typeName );
- assertNotNull(typeMatches);
- assertEquals("wrong size", 1, typeMatches.length);
- String[] typesNames = typeMatches[0];
- assertEquals("wrong size", 2, typesNames.length);
- assertEquals("Wrong part 1", "java.lang", typesNames[0]);
- assertEquals("Wrong part 2", "Object", typesNames[1]);
- }
-
- public void test0168() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "import java.util.List;\n" +
- "public class X {\n" +
- " void f() {\n" +
- " List<?> list = null;\n" +
- " System.out.println(list);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression argument = (Expression) arguments.get(0);
- ITypeBinding typeBinding = argument.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("Not a parameterized binding", typeBinding.isParameterizedType());
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- assertEquals("Wrong size", 1, typeArguments.length);
- final ITypeBinding typeBinding2 = typeArguments[0];
- assertTrue("Not a capture binding", typeBinding2.isCapture());
- assertTrue("Not from source", typeBinding2.isFromSource());
- assertNotNull("No wildcard", typeBinding2.getWildcard());
- }
-
- public void test0169() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " static class BB<T, S> { }\n" +
- " static class BD<T> extends BB<T, T> { }\n" +
- " void f() {\n" +
- " BB<? extends Number, ? super Integer> bb = null;\n" +
- " Object o = (BD<Number>) bb;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 1, "Type safety: Unchecked cast from X.BB<capture#1-of ? extends Number,capture#2-of ? super Integer> to X.BD<Number>");
- node = getASTNode(compilationUnit, 0, 2, 1);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not a cast expression", ASTNode.CAST_EXPRESSION, expression.getNodeType());
- CastExpression castExpression = (CastExpression) expression;
- Expression expression2 = castExpression.getExpression();
- ITypeBinding typeBinding = expression2.resolveTypeBinding();
- assertTrue("Not a parameterized type", typeBinding.isParameterizedType());
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- assertEquals("Wrong size", 2, typeArguments.length);
- final ITypeBinding typeBinding2 = typeArguments[0];
- assertTrue("Not a capture binding", typeBinding2.isCapture());
- ITypeBinding wildcardBinding = typeBinding2.getWildcard();
- assertNotNull("No wildcard binding", wildcardBinding);
- assertTrue("Not from source", typeBinding2.isFromSource());
- assertTrue("Not a wildcard", wildcardBinding.isWildcardType());
- }
-
- public void test0170() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " static class BB<T, S> { }\n" +
- " static class BD<T> extends BB<T, T> { }\n" +
- " static BB<? extends Number, ? super Integer> bb = null;\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(/*start*/X.bb/*end*/);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, node.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) node;
- ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
- assertTrue("Not a parameterized type", typeBinding.isParameterizedType());
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- assertEquals("Wrong size", 2, typeArguments.length);
- final ITypeBinding typeBinding2 = typeArguments[0];
- assertTrue("Not a capture binding", typeBinding2.isCapture());
- ITypeBinding wildcardBinding = typeBinding2.getWildcard();
- assertNotNull("No wildcard binding", wildcardBinding);
- assertTrue("Not from source", typeBinding2.isFromSource());
- assertTrue("Not a wildcard", wildcardBinding.isWildcardType());
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92361
- */
- public void test0171() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- "\n" +
- " java.util.List<? extends Runnable> list;\n" +
- " Object o= /*start*/list/*end*/;\n" +
- "}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, node.getNodeType());
- ITypeBinding type = ((SimpleName)node).resolveTypeBinding();
- assertNull("Unexpected element", type.getTypeArguments()[0].getJavaElement());
- }
-
- /*
- * Ensures that 2 different capture bindings are not "isEqualTo(...)".
- * (regression test for bug 92888 ITypeBinding#isEqualTo(..) is wrong for capture bindings)
- */
- public void test0172() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<T> {\n" +
- " private static X<? super Number> num() {\n" +
- " return null;\n" +
- " }\n" +
- " void add(T t) {\n" +
- " }\n" +
- " void foo() {\n" +
- " Number n= null;\n" +
- " /*start1*/num().add(null)/*end1*/;\n" +
- " /*start2*/num().add(n)/*end2*/;\n" +
- " }\n" +
- "}\n";
- IBinding[] bindings = resolveBindings(contents, this.workingCopy);
- assertTrue("2 different capture bindings should not be equals", !bindings[0].isEqualTo(bindings[1]));
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=93093
- */
- public void test0173() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.Vector;\n" +
- "\n" +
- "public class X {\n" +
- " void test1() {\n" +
- " Vector<? extends Number[]> v = null;\n" +
- " /*start*/v.get(0)/*end*/;\n" +
- " }\n" +
- "}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- ITypeBinding type = ((Expression)node).resolveTypeBinding();
- assertTrue("Should be one bound", type.getTypeBounds().length == 1);
- assertEquals("Invalid bound", "[Ljava.lang.Number;", type.getTypeBounds()[0].getBinaryName());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92982
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=88202
- */
- public void test0174() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.*;\n" +
- "\n" +
- "public class X {\n" +
- " void test1() {\n" +
- " List<? extends Collection> l = null;\n" +
- " /*start*/l.get(0)/*end*/;\n" +
- " }\n" +
- "}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- ITypeBinding type = ((Expression)node).resolveTypeBinding();
- assertTrue("Should be one bound", type.getTypeBounds().length == 1);
- assertEquals("Invalid bound", "java.util.Collection", type.getTypeBounds()[0].getBinaryName());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=88202
- */
- public void test0175() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.*;\n" +
- "\n" +
- "public class X {\n" +
- " void test1() {\n" +
- " List<?> l = null;\n" +
- " /*start*/l.get(0)/*end*/;\n" +
- " }\n" +
- "}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- ITypeBinding type = ((Expression)node).resolveTypeBinding();
- assertTrue("Should be no bound", type.getTypeBounds().length == 0);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92982
- */
- public void test0176() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.*;\n" +
- "\n" +
- "public class X<T extends Collection> {\n" +
- " void test1() {\n" +
- " List<T> l = null;\n" +
- " /*start*/l.get(0)/*end*/;\n" +
- " }\n" +
- "}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- ITypeBinding type = ((Expression)node).resolveTypeBinding();
- assertTrue("Should be one bound", type.getTypeBounds().length == 1);
- assertEquals("Invalid bound", "java.util.Collection", type.getTypeBounds()[0].getBinaryName());
- }
-
- /*
- * Ensure that the declaring class of a capture binding is correct
- * (https://bugs.eclipse.org/bugs/show_bug.cgi?id=93275)
- */
- public void test0177() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<T> {\n" +
- " Object foo(X<?> list) {\n" +
- " return /*start*/list.get()/*end*/;\n" +
- " }\n" +
- " T get() {\n" +
- " return null;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- FunctionInvocation methodInvocation = (FunctionInvocation) node;
- ITypeBinding capture = methodInvocation.resolveTypeBinding();
- ITypeBinding declaringClass = capture.getDeclaringClass();
- assertBindingEquals("LX<TT;>;", declaringClass);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=93075
- */
- public void test0178() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.Vector;\n" +
- "\n" +
- "public class X {\n" +
- " void foo() {\n" +
- " Vector< ? super java.util.Collection<? super java.lang.Number> > lhs= null; \n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- checkSourceRange(type, "Vector< ? super java.util.Collection<? super java.lang.Number> >", contents);
- assertEquals("Not a parameterized type", ASTNode.PARAMETERIZED_TYPE, type.getNodeType());
- ParameterizedType parameterizedType = (ParameterizedType) type;
- List typeArguments = parameterizedType.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- Type typeArgument = (Type) typeArguments.get(0);
- assertEquals("Not a wildcard type", ASTNode.WILDCARD_TYPE, typeArgument.getNodeType());
- WildcardType wildcardType = (WildcardType) typeArgument;
- checkSourceRange(wildcardType, "? super java.util.Collection<? super java.lang.Number>", contents);
- Type bound = wildcardType.getBound();
- assertEquals("Not a parameterized type", ASTNode.PARAMETERIZED_TYPE, bound.getNodeType());
- ParameterizedType parameterizedType2 = (ParameterizedType) bound;
- checkSourceRange(bound, "java.util.Collection<? super java.lang.Number>", contents);
- typeArguments = parameterizedType2.typeArguments();
- assertEquals("Wrong size", 1, typeArguments.size());
- typeArgument = (Type) typeArguments.get(0);
- assertEquals("Not a wildcard type", ASTNode.WILDCARD_TYPE, typeArgument.getNodeType());
- wildcardType = (WildcardType) typeArgument;
- checkSourceRange(wildcardType, "? super java.lang.Number", contents);
- }
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92360
- */
- public void test0180() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import java.util.List;\n" +
- "public class X {\n" +
- " List</*start*/? extends Runnable/*end*/> list;\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a wildcard type", ASTNode.WILDCARD_TYPE, node.getNodeType());
- WildcardType wildcardType = (WildcardType) node;
- ITypeBinding typeBinding = wildcardType.resolveBinding();
- assertTrue("Not a wildcard type", typeBinding.isWildcardType());
- assertFalse("Not an class", typeBinding.isClass());
- }
-
- /*
- * Ensures that 2 different parameterized type bindings are not "isEqualTo(...)".
- * (regression test for bug 93408 ITypeBinding#isEqualTo(..) does not resolve type variables)
- */
- public void test0181() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<E> {\n" +
- " /*start1*/Y<E>/*end1*/ y;\n" +
- " static class Other<E> {\n" +
- " /*start2*/Y<E>/*end2*/ y;\n" +
- " }\n" +
- "}\n" +
- "class Y<E> {\n" +
- "}";
- IBinding[] bindings = resolveBindings(contents, this.workingCopy);
- assertTrue("2 different parameterized type bindings should not be equals", !bindings[0].isEqualTo(bindings[1]));
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=95911
- */
- public void test0182() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "import java.util.Map;\n" +
- "\n" +
- "public class X {\n" +
- " public void foo() {\n" +
- " Map<String, Number> map= new Map<String, Number>() {\n" +
- " };\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- String expectedSource = "map= new Map<String, Number>() {\n" +
- " }";
- checkSourceRange(fragment, expectedSource, contents);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=95911
- */
- public void test0183() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "import java.util.Map;\n" +
- "\n" +
- "public class X {\n" +
- " Map<String, Number> map= new Map<String, Number>() {\n" +
- " };\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- String expectedSource = "map= new Map<String, Number>() {\n" +
- " }";
- checkSourceRange(fragment, expectedSource, contents);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=97841
- */
- public void test0184() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "public class X {\n" +
- " java.util.Map<String, Number> map= new java.util.Map<String, Number>() {\n" +
- " };\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- ITypeBinding binding = initializer.resolveTypeBinding();
- assertNotNull("No binding", binding);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=98086
- */
- public void test0185() throws JavaScriptModelException {
- final IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0185", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong setting", JavaScriptCore.WARNING, sourceUnit.getJavaScriptProject().getOption(JavaScriptCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, true));
- final ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- final JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=98086
- */
- public void test0186() throws JavaScriptModelException {
- final IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0186", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong setting", JavaScriptCore.WARNING, sourceUnit.getJavaScriptProject().getOption(JavaScriptCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, true));
- final ASTNode result = runJLS3Conversion(sourceUnit, true, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- final JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 2, "Type safety: The expression of type ArrayList needs unchecked conversion to conform to List<String>\n" +
- "ArrayList is a raw type. References to generic type ArrayList<T> should be parameterized");
- }
-
- /*
- * Ensures that the binding key of a parameterized type can be computed when it contains a reference to a type variable.
- * (regression test for bug 98259 NPE computing ITypeBinding#getKey())
- */
- public void test0187() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "public class X {\n" +
- " <T> /*start*/Y<T>/*end*/ foo() {\n" +
- " return null;" +
- " };\n" +
- "}\n" +
- "class Y<E> {\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- ParameterizedType type = (ParameterizedType) node;
- assertBindingEquals(
- "LX~Y<LX;:1TT;>;",
- type.resolveBinding());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=98473
- */
- public void test0188() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "import java.util.List;\n" +
- "\n" +
- "public class X {\n" +
- " class Counter<T, /*start*/L extends List<T>/*end*/> {\n" +
- " private L _attribute;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a type parameter", ASTNode.TYPE_PARAMETER, node.getNodeType());
- ITypeBinding typeBinding = ((TypeParameter) node).resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertFalse("Cannot be top level", typeBinding.isTopLevel());
- assertFalse("A class", typeBinding.isClass());
- assertFalse("An interface", typeBinding.isInterface());
- assertTrue("Not a type variable", typeBinding.isTypeVariable());
- assertTrue("Not from source", typeBinding.isFromSource());
- }
-
- public void test0189() throws CoreException, IOException {
- try {
- IJavaScriptProject project = createJavaProject("P1", new String[] {""}, new String[] {"CONVERTER_JCL15_LIB"}, "", "1.5");
- addLibrary(project, "lib.jar", "src.zip", new String[] {
- "/P1/p/I1.js",
- "package p;\n" +
- "public class I1<E> {\n" +
- "}",
- "/P1/p/I2.js",
- "package p;\n" +
- "public interface I2<K, V> {\n" +
- " interface I3<K,V> {}\n" +
- " I1<I2.I3<K, V>> foo();\n" +
- "}",
- "/P1/p/X.js",
- "package p;\n" +
- "public class X<K,V> implements I2<K,V> {\n" +
- " public I1<I2.I3<K,V>> foo() {\n" +
- " return null;\n" +
- " } \n" +
- "}"
- }, "1.5");
- this.workingCopy = getWorkingCopy("/P1/p1/Y.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p1;\n" +
- "import p.*;\n" +
- "public abstract class Y implements I2 {\n" +
- " public I1 foo() {\n" +
- " return /*start*/bar().foo()/*end*/;\n" +
- " }\n" +
- " private X bar() {\n" +
- " return null;\n" +
- " }\n" +
- "}",
- this.workingCopy,
- false);
- FunctionInvocation method = (FunctionInvocation) node;
- IFunctionBinding methodBinding = method.resolveMethodBinding();
- assertBindingEquals(
- "Lp/X;.foo()Lp/I1<Lp/I2$I3<TK;TV;>;>;",
- methodBinding.getMethodDeclaration());
- } finally {
- deleteProject("P1");
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=99355
- public void test0190() throws CoreException, IOException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String contents =
- "class Container<T> {\n" +
- " private final T m_t;\n" +
- "\n" +
- " public Container(T t) {\n" +
- " m_t = t;\n" +
- " }\n" +
- "\n" +
- " T get() {\n" +
- " return m_t;\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "class GenericContainer {\n" +
- " private final Container<?> m_c;\n" +
- "\n" +
- " public GenericContainer(Container<?> c) {\n" +
- " m_c = c;\n" +
- " }\n" +
- "\n" +
- " public Container<?> getC() {\n" +
- " return m_c;\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "public class X {\n" +
- " GenericContainer createContainer() {\n" +
- " final Container<String> innerContainer = new Container<String>(\"hello\");\n" +
- " final Container<Container<String>> outerContainer = new Container<Container<String>>(\n" +
- " innerContainer);\n" +
- " return new GenericContainer(outerContainer);\n" +
- " }\n" +
- "\n" +
- " void method() {\n" +
- " final GenericContainer createContainer = createContainer();\n" +
- " /*start*/@SuppressWarnings(\"unchecked\")\n" +
- " final Container<Container<String>> c = (Container<Container<String>>) createContainer.getC();/*end*/\n" +
- " final Container<String> container = c.get();\n" +
- " final String string = container.get();\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List modifiers = statement.modifiers();
- assertEquals("Wrong size", 2, modifiers.size());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=99510
- public void test0191() throws CoreException, IOException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0191", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Type safety: Unchecked cast from Collection<capture#1-of ? extends Number> to Vector<Object>");
- node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- assertEquals("Not a cast expression", ASTNode.CAST_EXPRESSION, initializer.getNodeType());
- CastExpression castExpression = (CastExpression) initializer;
- Type type = castExpression.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- Expression expression = castExpression.getExpression();
- ITypeBinding typeBinding2 = expression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding2);
- assertTrue("Not cast compatible", typeBinding2.isCastCompatible(typeBinding));
- }
-
- // Wrong ParameterizedTypeBinding yields null type declaration result
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=100584
- public void test0192() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<E> {\n" +
- " public static class InnerClass {\n" +
- " static class InnerInnerClass {\n" +
- " /*start*/X.WrongInnerClass/*end*/.InnerInnerClass m;\n" +
- " }\n" +
- " }\n" +
- "}";
- IBinding[] bindings = resolveBindings(contents, this.workingCopy, false/*don't report errors*/);
- if (bindings[0] != null) {
- // should not get here if patch 100584 applied
- try {
- bindings[0].toString();
- fail("should get an exception if bug 100584 present");
- // which means that the code would now return a non null,
- // erroneous binding, yet able to respond to toString
- } catch (Throwable t) {/* absorb quietly */}
- }
- assertTrue("should yield a null, not a malformed binding",
- bindings[0] == null);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=104492
- public void test0193() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " byte[] b1 = new byte[0];\n" +
- " byte[] b2 = new byte[0];\n" +
- " for (byte[] bs : new byte[][] { b1, b2 }) {}\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- node = getASTNode(unit, 0, 0, 2);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) node;
- SingleVariableDeclaration singleVariableDeclaration = forStatement.getParameter();
- assertEquals("Should be 0", 0, singleVariableDeclaration.getExtraDimensions());
- Type type = singleVariableDeclaration.getType();
- assertEquals("Not an array type", ASTNode.ARRAY_TYPE, type.getNodeType());
- ArrayType arrayType = (ArrayType) type;
- assertEquals("Should be 1", 1, arrayType.getDimensions());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=104492
- public void test0194() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " byte[] b1 = new byte[0];\n" +
- " byte[] b2 = new byte[0];\n" +
- " for (byte[] bs/*comment*/ [ /*comment*/ ]: new byte[][][] { new byte[][] { b1, b2 }}) {}\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- node = getASTNode(unit, 0, 0, 2);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) node;
- SingleVariableDeclaration singleVariableDeclaration = forStatement.getParameter();
- assertEquals("Should be 1", 1, singleVariableDeclaration.getExtraDimensions());
- Type type = singleVariableDeclaration.getType();
- assertEquals("Not an array type", ASTNode.ARRAY_TYPE, type.getNodeType());
- ArrayType arrayType = (ArrayType) type;
- assertEquals("Should be 1", 1, arrayType.getDimensions());
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106834
- public void test0195() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " <S extends Number, T> void take(S e, T f) {}\n" +
- " <S extends Number, T> void take(T e, S f) {}\n" +
- " <S extends Number, T extends S> void take(T e, S f) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
-
- node = getASTNode(unit, 0, 1);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration2 = (FunctionDeclaration) node;
- IFunctionBinding methodBinding2 = methodDeclaration2.resolveBinding();
-
- node = getASTNode(unit, 0, 2);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration3 = (FunctionDeclaration) node;
- IFunctionBinding methodBinding3 = methodDeclaration3.resolveBinding();
-
- assertFalse("Bindings are equals", methodBinding.isEqualTo(methodBinding2));
- assertFalse("Bindings are equals", methodBinding2.isEqualTo(methodBinding));
- assertFalse("Bindings are equals", methodBinding3.isEqualTo(methodBinding));
- assertFalse("Bindings are equals", methodBinding3.isEqualTo(methodBinding2));
- assertFalse("Bindings are equals", methodBinding2.isEqualTo(methodBinding3));
- assertFalse("Bindings are equals", methodBinding.isEqualTo(methodBinding3));
- assertTrue("Bindings are not equals", methodBinding3.isEqualTo(methodBinding3));
- assertTrue("Bindings are not equals", methodBinding2.isEqualTo(methodBinding2));
- assertTrue("Bindings are not equals", methodBinding.isEqualTo(methodBinding));
- }
-
- /*
- * Ensures that the signature of and IBinding representing a local type ends with the local type's simple name.
- * (regression test for bug 104879 BindingKey#internalToSignature() returns invalid signature for local type
- */
- public void test0196() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "public class X {\n" +
- " void foo() {\n" +
- " /*start*/class Y {\n" +
- " }/*end*/\n" +
- " }\n" +
- "}",
- this.workingCopy);
- IBinding binding = ((TypeDeclarationStatement) node).resolveBinding();
- assertNotNull("No binding", binding);
-
- String key = binding.getKey();
- String signature = new BindingKey(key).toSignature();
- String simpleName = Signature.getSimpleName(Signature.toString(signature));
- assertEquals("Unexpected simple name", "Y", simpleName);
- }
-
-
- /*
- * Ensures that creating an AST with binding resolution where there is a problem in a binary
- * doesn't throw an NPE
- * (regression test for bug 100606 NPE during reconcile)
- */
- public void test0197() throws CoreException {
- try {
- createJavaProject("P", new String[] {"src" }, new String[] {"CONVERTER_JCL15_LIB", "/P/lib"}, "bin", "1.5");
- IFolder folder = createFolder("/P/lib");
- String classesPath = folder.getLocation().toOSString();
- Map options = new HashMap();
- String[] pathsAndContents = new String[] {
- "p/Bin.js",
- "package p;\n" +
- "public class Bin {\n" +
- "}",
- "p/BinSub.js",
- "package p;\n" +
- "public class BinSub extends Bin {\n" +
- "}",
- };
- Util.compile(pathsAndContents, options, classesPath);
- folder.refreshLocal(IResource.DEPTH_INFINITE, null);
-// folder.getFolder("p").getFile("Bin.class").delete(false, null);
- Util.delete(folder.getFolder("p").getFile("Bin.class"));
- this.workingCopy = getWorkingCopy("/P/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " void bar() throws p.BinSub {\n" +
- " }\n" +
- " </*start*/T/*end*/> void foo() {\n" +
- " }\n" +
- "}";
- IBinding[] bindings = resolveBindings(contents, this.workingCopy, false/*don't report errors*/);
- assertBindingsEqual(
- "LX;.foo<T:Ljava/lang/Object;>()V:TT;",
- bindings);
- } finally {
- deleteProject("P");
- }
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=110773
- */
- public void test0198() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "public class X<E> {\n" +
- " class B { }\n" +
- " {\n" +
- " X<String>.B b;\n" +
- " }\n" +
- "}",
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a initializer", ASTNode.INITIALIZER, node.getNodeType());
- Initializer initializer = (Initializer) node;
- Block block = initializer.getBody();
- assertNotNull("No block", block);
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement = (Statement) statements.get(0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType());
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- Type type = variableDeclarationStatement.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding2 = typeDeclaration.resolveBinding();
- assertTrue("Not a member type", typeDeclaration.isMemberTypeDeclaration());
- assertFalse("Binding should not be equals", typeBinding.isEqualTo(typeBinding2));
- assertFalse("Binding should not be equals", typeBinding2.isEqualTo(typeBinding));
- ITypeBinding typeBinding3 = typeBinding.getTypeDeclaration();
- assertFalse("Binding should not be equals", typeBinding.isEqualTo(typeBinding3));
- assertFalse("Binding should not be equals", typeBinding3.isEqualTo(typeBinding));
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=110657
- */
- public void test0199() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String source = "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " byte[] b1 = new byte[0];\n" +
- " byte[] b2 = new byte[0];\n" +
- " for (byte[] bs : new byte[][] { b1, b2 }) {\n" +
- " System.out.println(bs);\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- source,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 2);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) node;
- final SingleVariableDeclaration parameter = forStatement.getParameter();
- final Type type = parameter.getType();
- checkSourceRange(type, "byte[]", source);
- checkSourceRange(parameter, "byte[] bs", source);
- assertTrue("not an array type", type.isArrayType());
- ArrayType arrayType = (ArrayType) type;
- Type elementType = arrayType.getElementType();
- assertTrue("not a primitive type", elementType.isPrimitiveType());
- checkSourceRange(elementType, "byte", source);
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=110657
- */
- public void test0200() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String source = "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " byte[] b1 = new byte[0];\n" +
- " byte[] b2 = new byte[0];\n" +
- " for (final byte[] bs : new byte[][] { b1, b2 }) {\n" +
- " System.out.println(bs);\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- source,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 2);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) node;
- final SingleVariableDeclaration parameter = forStatement.getParameter();
- final Type type = parameter.getType();
- checkSourceRange(type, "byte[]", source);
- checkSourceRange(parameter, "final byte[] bs", source);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=110657
- */
- public void test0201() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String source = "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " byte[] b1 = new byte[0];\n" +
- " byte[] b2 = new byte[0];\n" +
- " for (final byte bs[] : new byte[][] { b1, b2 }) {\n" +
- " System.out.println(bs);\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- source,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 2);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, node.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) node;
- final SingleVariableDeclaration parameter = forStatement.getParameter();
- final Type type = parameter.getType();
- assertEquals("Wrong extended dimension", 1, parameter.getExtraDimensions());
- checkSourceRange(type, "byte", source);
- checkSourceRange(parameter, "final byte bs[]", source);
- assertTrue("not a primitive type", type.isPrimitiveType());
- }
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=80472
- */
- public void test0203() throws CoreException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- final String source = "class X<T> {\n" +
- " X<T> list= this;\n" +
- " X<? super T> list2= this;\n" +
- "}";
- ASTNode node = buildAST(
- source,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- ITypeBinding typeBinding = initializer.resolveTypeBinding();
- assertTrue("Not a parameterized binding", typeBinding.isParameterizedType());
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- initializer = fragment.getInitializer();
- typeBinding = initializer.resolveTypeBinding();
- assertTrue("Not a parameterized binding", typeBinding.isParameterizedType());
- }
-
- /*
- * Ensures that the key of parameterized type binding with a raw enclosing type is correct
- * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=83064)
- */
- public void test0204() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<T> {\n" +
- " static class Y {\n" +
- " /*start*/Y/*end*/ y;\n" +
- " }\n" +
- "}";
- IBinding[] bindings = resolveBindings(contents, this.workingCopy);
- assertBindingsEqual(
- "LX<>.Y;",
- bindings);
- }
-
- /*
- * Ensures that the declaration method binding and the reference method bindings are the same
- * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=83064)
- */
- public void test0205() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<E> {\n" +
- " @I(12)\n" +
- " @interface I {\n" +
- " @I(/*start1*/value/*end1*/=13)\n" +
- " int /*start2*/value/*end2*/();\n" +
- " }\n" +
- "}";
- IBinding[] bindings = resolveBindings(contents, this.workingCopy);
- assertFalse("Declaration and reference keys should not be the same", bindings[0].getKey().equals(bindings[1].getKey()));
- }
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=124716
- */
- public void test0207() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " void m() {\n" +
- " new Object() {};\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("Should not be null", binding);
- }
-
-
- public void test0210() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", false);
- String contents =
- "public class X {\n" +
- " void foo(Object r) {\n" +
- " if (r instanceof Future<?>) {\n" +
- " System.out.println(\"TRUE\");\n" +
- " } else {\n" +
- " System.out.println(\"FALSE\");\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertNotNull("No node", node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- checkSourceRange(expression, "r instanceof Future<?>", contents);
- assertEquals("Not an instanceof expression", ASTNode.INSTANCEOF_EXPRESSION, expression.getNodeType());
- InstanceofExpression instanceofExpression = (InstanceofExpression) expression;
- Type type = instanceofExpression.getRightOperand();
- checkSourceRange(type, "Future<?>", contents);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=129096
- */
- public void test0211() throws JavaScriptModelException {
- String contents =
- "public class X {\n" +
- " void foo(java.util.List<?> tab[]) {\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("wrong number", 1, parameters.size());
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(variableDeclaration, "java.util.List<?> tab[]", contents);
- checkSourceRange(variableDeclaration.getType(), "java.util.List<?>", contents);
- checkSourceRange(variableDeclaration.getName(), "tab", contents);
- assertEquals("wrong number of extra dimensions", 1, variableDeclaration.getExtraDimensions());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=129096
- */
- public void test0212() throws JavaScriptModelException {
- String contents =
- "public class X {\n" +
- " void foo(java.util.List<?> tab[][]) {\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("wrong number", 1, parameters.size());
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(variableDeclaration, "java.util.List<?> tab[][]", contents);
- checkSourceRange(variableDeclaration.getType(), "java.util.List<?>", contents);
- checkSourceRange(variableDeclaration.getName(), "tab", contents);
- assertEquals("wrong number of extra dimensions", 2, variableDeclaration.getExtraDimensions());
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=130528
- */
- public void test0213() throws JavaScriptModelException {
- String contents =
- "public class X {\n" +
- " int test(String[] strings) {\n" +
- " return strings.length;\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType());
- QualifiedName name = (QualifiedName) expression;
- SimpleName simpleName = name.getName();
- checkSourceRange(simpleName, "length", contents);
- IBinding binding = simpleName.resolveBinding();
- assertEquals("Not a field", IBinding.VARIABLE, binding.getKind());
- }
-
- /*
- * Check unique instance of generic method bindings
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=104293
- */
- public void test0214() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " \n" +
- " <T extends A> T foo(T t) {\n" +
- " return t;\n" +
- " }\n" +
- " public static void main(String[] args) {\n" +
- " new X().bar();\n" +
- " }\n" +
- " void bar() {\n" +
- " B b1 = foo(new B());\n" +
- " B b2 = foo(new B());\n" +
- " }\n" +
- "}\n" +
- "\n" +
- "class A {}\n" +
- "class B extends A {}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 2, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment= (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 2, 1);
- assertEquals("Not a compilation unit", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- statement = (VariableDeclarationStatement) node;
- fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment= (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding2 = invocation.resolveMethodBinding();
-
- assertTrue("Not identical", methodBinding == methodBinding2);
- }
-
- /*
- * Check unique instance of generic method bindings
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=104293
- */
- public void test0215() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " static <T> T identity(T t) { return t; }\n" +
- "\n" +
- " public static void main(String[] args) {\n" +
- " String s = \"aaa\";\n" +
- " identity(s);\n" +
- " identity(s);\n" +
- " identity(s);\n" +
- "\n" +
- " Object o = new Object();\n" +
- " identity(o);\n" +
- " identity(o);\n" +
- " identity(o);\n" +
- "\n" +
- " Throwable t = null;\n" +
- " identity(t);\n" +
- " identity(t);\n" +
- " identity(t);\n" +
- "\n" +
- " Exception e = null;\n" +
- " identity(e);\n" +
- " identity(e);\n" +
- " identity(e);\n" +
- "\n" +
- " NullPointerException npe = null;\n" +
- " identity(npe);\n" +
- " identity(npe);\n" +
- " identity(npe);\n" +
- "\n" +
- " Cloneable c = null;\n" +
- " identity(c);\n" +
- " identity(c);\n" +
- " identity(c);\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 1, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 2);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding2 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 3);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding3 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 5);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding4 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 6);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding5 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 9);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding6 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 10);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding7 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 11);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding8 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 13);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding9 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 14);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding10 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 15);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding11 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 17);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding12 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 18);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding13 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 19);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding14 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 21);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding15 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 22);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding16 = invocation.resolveMethodBinding();
-
- node = getASTNode(unit, 0, 1, 23);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- statement = (ExpressionStatement) node;
- expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding17 = invocation.resolveMethodBinding();
-
- assertTrue("method bindings are not equals", methodBinding == methodBinding2);
- assertTrue("method bindings are not equals", methodBinding2 == methodBinding3);
- assertTrue("method bindings are not equals", methodBinding4 == methodBinding5);
- assertTrue("method bindings are not equals", methodBinding6 == methodBinding7);
- assertTrue("method bindings are not equals", methodBinding7 == methodBinding8);
- assertTrue("method bindings are not equals", methodBinding9 == methodBinding10);
- assertTrue("method bindings are not equals", methodBinding9 == methodBinding11);
- assertTrue("method bindings are not equals", methodBinding12 == methodBinding13);
- assertTrue("method bindings are not equals", methodBinding14 == methodBinding13);
- assertTrue("method bindings are not equals", methodBinding15 == methodBinding16);
- assertTrue("method bindings are not equals", methodBinding17 == methodBinding16);
- }
-
- /*
- * Check unique instance of generic method bindings
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=104293
- */
- public void test0216() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class Y<T> {\n" +
- " <T> Class foo(T t) {\n" +
- " return t.getClass();\n" +
- " }\n" +
- "}\n" +
- "public class X { \n" +
- " \n" +
- " public static void main(String[] args) { \n" +
- " Class c = new Y().foo(null);\n" +
- " Class c2 = new Y().foo(null);\n" +
- " } \n" +
- "}\n" +
- "";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedOutput =
- "Class is a raw type. References to generic type Class<T> should be parameterized\n" +
- "Class is a raw type. References to generic type Class<T> should be parameterized\n" +
- "Type safety: The method foo(Object) belongs to the raw type Y. References to generic type Y<T> should be parameterized\n" +
- "Y is a raw type. References to generic type Y<T> should be parameterized\n" +
- "Class is a raw type. References to generic type Class<T> should be parameterized\n" +
- "Type safety: The method foo(Object) belongs to the raw type Y. References to generic type Y<T> should be parameterized\n" +
- "Y is a raw type. References to generic type Y<T> should be parameterized";
- assertProblemsSize(unit, 7, expectedOutput);
- node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment= (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = invocation.resolveMethodBinding();
- assertTrue("Not a raw method", methodBinding.isRawMethod());
-
- node = getASTNode(unit, 1, 0, 1);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- statement = (VariableDeclarationStatement) node;
- fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment= (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding2 = invocation.resolveMethodBinding();
- assertTrue("Not a raw method", methodBinding2.isRawMethod());
-
- assertTrue("Method bindings are not identical", methodBinding == methodBinding2);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=110799
- */
- public void test0217() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class Generic<E> {\n" +
- "}\n" +
- "public class X {\n" +
- " Generic raw;\n" +
- " java.util.Collection rawCollection;\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedOutput =
- "Generic is a raw type. References to generic type Generic<E> should be parameterized\n" +
- "Collection is a raw type. References to generic type Collection<T> should be parameterized";
- assertProblemsSize(unit, 2, expectedOutput);
- node = getASTNode(unit, 1, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertTrue("isRaw", typeBinding.isRawType());
-
- node = getASTNode(unit, 1, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- type = fieldDeclaration.getType();
- ITypeBinding typeBinding2 = type.resolveBinding();
- assertTrue("isRaw", typeBinding2.isRawType());
-
- ITypeBinding[] typeParameters = typeBinding.getTypeParameters();
- assertEquals("Wrong size", 0, typeParameters.length);
-
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- assertEquals("Wrong size", 0, typeArguments.length);
-
- typeParameters = typeBinding2.getTypeParameters();
- assertEquals("Wrong size", 0, typeParameters.length);
-
- typeArguments = typeBinding2.getTypeArguments();
- assertEquals("Wrong size", 0, typeArguments.length);
- }
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=142793
- * updated for https://bugs.eclipse.org/bugs/show_bug.cgi?id=143001
- */
- public void test0220() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " void bar(String[] c) {\n" +
- " for(String s: c) {\n" +
- " try {\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Syntax error, insert \"Finally\" to complete BlockStatements");
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block body = methodDeclaration.getBody();
- assertNotNull("No body", body);
- List statements = body.statements();
- assertEquals("Wrong size", 1, statements.size());
- assertTrue("Recovered", !isRecovered(body));
- assertFalse("Malformed", isMalformed(body));
-
- Statement statement = (Statement)statements.get(0);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, statement.getNodeType());
- EnhancedForStatement enhancedForStatement = (EnhancedForStatement) statement;
- Statement forBody = enhancedForStatement.getBody();
- assertNotNull("No body", forBody);
- assertEquals("Not a block", ASTNode.BLOCK, forBody.getNodeType());
-
- statements = ((Block)forBody).statements();
- assertEquals("Wrong size", 1, statements.size());
- statement = (Statement)statements.get(0);
- assertEquals("Not an try statement", ASTNode.TRY_STATEMENT, statement.getNodeType());
- TryStatement tryStatement = (TryStatement) statement;
- Block finallyBlock = tryStatement.getFinally();
- assertNotNull("No finally block", finallyBlock);
- assertTrue("Not recovered", isRecovered(finallyBlock));
-
-
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=147875
- */
- public void test0221() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "import p1.p2.MyEnum;\n" +
- "public class X {\n" +
- " MyEnum foo() {\n" +
- " return null;\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=148797
- */
- public void test0222() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " public void a() {\n" +
- " Object a = null;\n" +
- " for (Object o : a.getClass()()) {\n" +
- " }\n" +
- " }\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 2, "Syntax error on token \")\", invalid Name\n" +
- "Syntax error, insert \")\" to complete EnhancedForStatementHeader");
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block body = methodDeclaration.getBody();
- assertNotNull("No body", body);
- List statements = body.statements();
- assertEquals("Wrong size", 2, statements.size());
- Statement statement = (Statement) statements.get(1);
- assertEquals("Not an enhanced for statement", ASTNode.ENHANCED_FOR_STATEMENT, statement.getNodeType());
- EnhancedForStatement forStatement = (EnhancedForStatement) statement;
- Expression expression = forStatement.getExpression();
- assertNotNull("No expression", expression);
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- }
-
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=167958
- */
- public void test0232() throws JavaScriptModelException {
- /*
- package test0232;
- import static java.lang.annotation.ElementType.*;
- import static java.lang.annotation.RetentionPolicy.*;
- import java.lang.annotation.Retention;
- import java.lang.annotation.Target;
-
- @Target(TYPE)
- @Retention(RUNTIME)
- @interface Annot {
- }
- package test0232;
- @Annot
- public class X {
- }
- */
- String contents =
- "import test0232.X;\n" +
- "public class A {\n" +
- " X test() {\n" +
- " return null;\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/A.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- Type type = declaration.getReturnType2();
- ITypeBinding typeBinding = type.resolveBinding();
- assertTrue("Not a binary type binding", !typeBinding.isFromSource());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=167958
- */
- public void test0233() throws JavaScriptModelException {
- /*
- package test0233;
-
- import static java.lang.annotation.ElementType.*;
- import static java.lang.annotation.RetentionPolicy.*;
-
- import java.lang.annotation.Retention;
- import java.lang.annotation.Target;
-
- @Target(TYPE)
- @Retention(CLASS)
- @interface Annot {
- String message() default "";
- }
-
- package test0233;
-
- @Annot(message="Hello, World!")
- public class X {
- }
- */
- String contents =
- "import test0233.X;\n" +
- "public class A {\n" +
- " X test() {\n" +
- " return null;\n" +
- " }\n" +
- "}";
- this.workingCopy = getWorkingCopy("/Converter15/src/A.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- Type type = declaration.getReturnType2();
- ITypeBinding typeBinding = type.resolveBinding();
- assertTrue("Not a binary type binding", !typeBinding.isFromSource());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=169744
- */
- public void test0234() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "class B {\n" +
- " <T> int m() {\n" +
- " return 0;\n" +
- " }\n" +
- "}\n" +
- "public class X<T> extends B {\n" +
- " int i = super.<T> m();\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 1, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- checkSourceRange(expression, "super.<T> m()", contents);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=172633
- */
- public void test0235() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/test0235/X.js", true/*resolve*/);
- String contents =
- "package test0235;\n" +
- "public class X implements I {\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedProblems = "The hierarchy of the type X is inconsistent\n" +
- "The type test0235.Zork cannot be resolved. It is indirectly referenced from required .class files";
- assertProblemsSize(unit, 2, expectedProblems);
- node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- ITypeBinding[] interfaces = typeBinding.getInterfaces();
- assertNotNull("No interfaces", interfaces);
- assertEquals("Wrong size", 1, interfaces.length);
- assertNotNull("Should not be null", interfaces[0]);
- ITypeBinding typeBinding2 = interfaces[0];
- interfaces = typeBinding2.getInterfaces();
- assertNotNull("No interfaces", interfaces);
- assertEquals("Wrong size", 0, interfaces.length);
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=172633
- */
- public void test0236() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X implements Runnable, Zork {\n" +
- " public void run() {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedProblems = "Zork cannot be resolved to a type";
- assertProblemsSize(unit, 1, expectedProblems);
- node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- ITypeBinding[] interfaces = typeBinding.getInterfaces();
- assertNotNull("No interfaces", interfaces);
- assertEquals("Wrong size", 1, interfaces.length);
- assertNotNull("Should not be null", interfaces[0]);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=173338
- */
- public void test0237() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/test0237/X.js", true/*resolve*/);
- String contents =
- "package test0237;\n" +
- "public class X {\n" +
- " Zork foo() {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedProblems = "Zork cannot be resolved to a type";
- assertProblemsSize(unit, 1, expectedProblems);
- node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- IFunctionBinding[] methodBindings = typeBinding.getDeclaredMethods();
- assertNotNull("No method bindings", methodBindings);
- assertEquals("wrong size", 1, methodBindings.length);
- assertFalse("Method is not the method foo", "foo".equals(methodBindings[0].getName()));
- assertNotNull("No return type", methodBindings[0].getReturnType());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=173338
- */
- public void test0238() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/test0238/X.js", true/*resolve*/);
- String contents =
- "package test0238;\n" +
- "public class X extends A {\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- typeBinding = typeBinding.getSuperclass();
- IFunctionBinding[] methodBindings = typeBinding.getDeclaredMethods();
- assertNotNull("No method bindings", methodBindings);
- assertEquals("wrong size", 0, methodBindings.length);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=173338
- */
- public void test0239() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/test0239/X.js", true/*resolve*/);
- String contents =
- "package test0239;\n" +
- "public class X extends A {\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- typeBinding = typeBinding.getSuperclass();
- IVariableBinding[] variableBindings = typeBinding.getDeclaredFields();
- assertNotNull("No variable bindings", variableBindings);
- assertEquals("wrong size", 0, variableBindings.length);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=107001
- */
- public void test0240() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X<T> {}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- ITypeBinding[] typeParameters = typeBinding.getTypeParameters();
- assertEquals("Wrong size", 1, typeParameters.length);
- ITypeBinding typeParameter = typeParameters[0];
- assertTrue("Not a type variable", typeParameter.isTypeVariable());
- assertEquals("Wrong binary name", "X$T", typeParameter.getBinaryName());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=107001
- */
- public void test0241() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " <T> void foo() {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No binding", methodBinding);
- ITypeBinding[] typeParameters = methodBinding.getTypeParameters();
- assertEquals("Wrong size", 1, typeParameters.length);
- ITypeBinding typeParameter = typeParameters[0];
- assertTrue("Not a type variable", typeParameter.isTypeVariable());
- assertEquals("Wrong binary name", "X$()V$T", typeParameter.getBinaryName());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=107001
- */
- public void test0242() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " <T> X() {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No binding", methodBinding);
- ITypeBinding[] typeParameters = methodBinding.getTypeParameters();
- assertEquals("Wrong size", 1, typeParameters.length);
- ITypeBinding typeParameter = typeParameters[0];
- assertTrue("Not a type variable", typeParameter.isTypeVariable());
- assertEquals("Wrong binary name", "X$()V$T", typeParameter.getBinaryName());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=107001
- */
- public void test0243() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/p/X.js", true/*resolve*/);
- String contents =
- "package p;\n" +
- "public class X<U,V> {\n" +
- " <T> X(Integer i) {}\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No binding", methodBinding);
- ITypeBinding[] typeParameters = methodBinding.getTypeParameters();
- assertEquals("Wrong size", 1, typeParameters.length);
- ITypeBinding typeParameter = typeParameters[0];
- assertTrue("Not a type variable", typeParameter.isTypeVariable());
- assertEquals("Wrong binary name", "p.X$(Ljava/lang/Integer;)V$T", typeParameter.getBinaryName());
- }
-
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=173849
- public void test0244() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/xy/X.js", true/*resolve*/);
- String contents =
- "package xy;\n" +
- "\n" +
- "public class X {\n" +
- " protected class Inner {\n" +
- " }\n" +
- "\n" +
- " Inner[] i;\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- IJavaScriptElement element = typeBinding.getJavaElement();
- assertNotNull("No element", element);
- assertTrue("Doesn't exist", element.exists());
- assertEquals("Wrong handle identifier", "=Converter15/src<xy{X.java[X[Inner", element.getHandleIdentifier());
- }
-
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=173849
- public void test0245() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/xy/X.js", true/*resolve*/);
- String contents =
- "package xy;\n" +
- "\n" +
- "public class X {\n" +
- " protected class Inner {\n" +
- " }\n" +
- "\n" +
- " Inner i;\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- IJavaScriptElement element = typeBinding.getJavaElement();
- assertNotNull("No element", element);
- assertTrue("Doesn't exist", element.exists());
- assertEquals("Wrong handle identifier", "=Converter15/src<xy{X.java[X[Inner", element.getHandleIdentifier());
- }
-
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=173849
- public void test0246() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter15/src/xy/X.js", true/*resolve*/);
- String contents =
- "package xy;\n" +
- "\n" +
- "public class X {\n" +
- " protected class Inner {\n" +
- " }\n" +
- "\n" +
- " Inner[][] i;\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No binding", typeBinding);
- IJavaScriptElement element = typeBinding.getJavaElement();
- assertNotNull("No element", element);
- assertTrue("Doesn't exist", element.exists());
- assertEquals("Wrong handle identifier", "=Converter15/src<xy{X.java[X[Inner", element.getHandleIdentifier());
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java
index f54fa8a..aaecdc4 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java
@@ -106,8 +106,8 @@
}
static {
-// TESTS_NUMBERS = new int[] { 356 };
}
+
public static Test suite() {
return buildModelTestSuite(ASTConverterAST3Test.class);
}
@@ -119,39 +119,15 @@
// check that we have the right tree
JavaScriptUnit unit = this.ast.newJavaScriptUnit();
- PackageDeclaration packageDeclaration = this.ast.newPackageDeclaration();
- packageDeclaration.setName(this.ast.newSimpleName("test0001"));//$NON-NLS-1$
- unit.setPackage(packageDeclaration);
- ImportDeclaration importDeclaration = this.ast.newImportDeclaration();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"),//$NON-NLS-1$
- this.ast.newSimpleName("util"));//$NON-NLS-1$
- importDeclaration.setName(name);
- importDeclaration.setOnDemand(true);
- unit.imports().add(importDeclaration);
- TypeDeclaration type = this.ast.newTypeDeclaration();
- type.setInterface(false);
- type.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- type.setName(this.ast.newSimpleName("Test"));//$NON-NLS-1$
FunctionDeclaration methodDeclaration = this.ast.newFunctionDeclaration();
methodDeclaration.setConstructor(false);
- methodDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- methodDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
methodDeclaration.setName(this.ast.newSimpleName("main"));//$NON-NLS-1$
- methodDeclaration.setReturnType2(this.ast.newPrimitiveType(PrimitiveType.VOID));
SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String"))));//$NON-NLS-1$
variableDeclaration.setName(this.ast.newSimpleName("args"));//$NON-NLS-1$
methodDeclaration.parameters().add(variableDeclaration);
org.eclipse.wst.jsdt.core.dom.Block block = this.ast.newBlock();
FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
+ methodInvocation.setName(this.ast.newSimpleName("print")); //$NON-NLS-1$
InfixExpression infixExpression = this.ast.newInfixExpression();
infixExpression.setOperator(InfixExpression.Operator.PLUS);
StringLiteral literal = this.ast.newStringLiteral();
@@ -164,16 +140,10 @@
ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
block.statements().add(expressionStatement);
methodDeclaration.setBody(block);
- type.bodyDeclarations().add(methodDeclaration);
- unit.types().add(type);
assertTrue("Both AST trees should be identical", result.subtreeMatch(new ASTMatcher(), unit));//$NON-NLS-1$
String expected =
- "package test0001;\n" +
- "import java.util.*;\n" +
- "public class Test {\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(\"Hello\" + \" world\");\n" +
- " }\n" +
+ "function main(args) {\n" +
+ " print(\"Hello\" + \" world\");\n" +
"}";
checkSourceRange(result, expected, source);
}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java
index ff4025e..a4e30de 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/AbstractASTTests.java
@@ -40,37 +40,33 @@
import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParameterizedType;
import org.eclipse.wst.jsdt.core.dom.QualifiedName;
import org.eclipse.wst.jsdt.core.dom.SimpleName;
import org.eclipse.wst.jsdt.core.dom.SimpleType;
import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeParameter;
-import org.eclipse.wst.jsdt.core.dom.WildcardType;
import org.eclipse.wst.jsdt.core.tests.model.ModifyingResourceTests;
import org.eclipse.wst.jsdt.core.tests.util.Util;
public class AbstractASTTests extends ModifyingResourceTests {
-// IJavaScriptUnit[] workingCopies;
-
public AbstractASTTests(String name) {
super(name);
}
-
+
/*
- * Removes the *start* and *end* markers from the given source
- * and remembers the positions.
+ * Removes the *start* and *end* markers from the given source and remembers
+ * the positions.
*/
public class MarkerInfo {
String path;
String source;
int[] astStarts, astEnds;
-
+
public MarkerInfo(String source) {
this(null, source);
}
+
public MarkerInfo(String path, String source) {
this.path = path;
this.source = source;
@@ -79,26 +75,29 @@
while (source.indexOf("/*start" + markerIndex + "*/") != -1) {
markerIndex++;
}
- int astNumber = source.indexOf("/*start*/") != -1 ? markerIndex : markerIndex-1;
+ int astNumber = source.indexOf("/*start*/") != -1 ? markerIndex
+ : markerIndex - 1;
this.astStarts = new int[astNumber];
this.astEnds = new int[astNumber];
-
+
for (int i = 1; i < markerIndex; i++)
- setStartAndEnd(i);
+ setStartAndEnd(i);
if (astNumber == markerIndex)
setStartAndEnd(-1);
}
-
+
public int indexOfASTStart(int astStart) {
for (int i = 0, length = this.astStarts.length; i < length; i++)
if (this.astStarts[i] == astStart)
return i;
return -1;
}
-
- private void removeMarkerFromSource(String marker, int sourceIndex, int astNumber) {
+
+ private void removeMarkerFromSource(String marker, int sourceIndex,
+ int astNumber) {
char[] markerChars = marker.toCharArray();
- this.source = new String(CharOperation.replace(this.source.toCharArray(), markerChars, CharOperation.NO_CHAR));
+ this.source = new String(CharOperation.replace(this.source
+ .toCharArray(), markerChars, CharOperation.NO_CHAR));
// shift previously recorded positions
int markerLength = markerChars.length;
for (int i = 0; i < astNumber; i++) {
@@ -108,32 +107,35 @@
this.astEnds[i] -= markerLength;
}
}
-
+
private void setStartAndEnd(int markerIndex) {
- String markerNumber;
+ String markerNumber;
if (markerIndex == -1) {
markerNumber = "";
markerIndex = this.astStarts.length; // *start* is always last
} else
markerNumber = Integer.toString(markerIndex);
-
+
String markerStart = "/*start" + markerNumber + "*/";
String markerEnd = "/*end" + markerNumber + "*/";
- int astStart = source.indexOf(markerStart); // start of AST inclusive
- this.astStarts[markerIndex-1] = astStart;
- removeMarkerFromSource(markerStart, astStart, markerIndex-1);
+ int astStart = source.indexOf(markerStart); // start of AST
+ // inclusive
+ this.astStarts[markerIndex - 1] = astStart;
+ removeMarkerFromSource(markerStart, astStart, markerIndex - 1);
int astEnd = this.source.indexOf(markerEnd); // end of AST exclusive
- this.astEnds[markerIndex-1] = astEnd;
- removeMarkerFromSource(markerEnd, astEnd, markerIndex-1);
+ this.astEnds[markerIndex - 1] = astEnd;
+ removeMarkerFromSource(markerEnd, astEnd, markerIndex - 1);
}
-
+
}
-
+
public class BindingRequestor extends ASTRequestor {
HashMap bindings = new HashMap();
+
public void acceptBinding(String bindingKey, IBinding binding) {
this.bindings.put(bindingKey, binding);
}
+
public IBinding[] getBindings(String[] bindingKeys) {
int length = this.bindings.size();
IBinding[] result = new IBinding[length];
@@ -143,7 +145,7 @@
return result;
}
}
-
+
protected void assertASTNodeEquals(String expected, ASTNode node) {
String actual = node.toString();
if (!expected.equals(actual)) {
@@ -151,7 +153,7 @@
}
assertEquals("Unexpected ast node", expected, actual);
}
-
+
protected void assertASTNodesEqual(String expected, List nodes) {
StringBuffer buffer = new StringBuffer();
Iterator iterator = nodes.iterator();
@@ -176,15 +178,16 @@
}
assertEquals("Unexpected ast nodes", expected, actual);
}
-
+
protected void assertBindingKeyEquals(String expected, String actual) {
- assertBindingKeysEqual(expected, new String[] {actual});
+ assertBindingKeysEqual(expected, new String[] { actual });
}
protected void assertBindingKeysEqual(String expected, String[] actualKeys) {
StringBuffer buffer = new StringBuffer();
for (int i = 0, length = actualKeys.length; i < length; i++) {
- if (i > 0) buffer.append('\n');
+ if (i > 0)
+ buffer.append('\n');
buffer.append(actualKeys[i]);
}
String actual = buffer.toString();
@@ -192,20 +195,19 @@
System.out.print(displayString(actual, 4));
System.out.println(',');
}
- assertEquals(
- "Unexpected binding keys",
- expected,
- actual);
+ assertEquals("Unexpected binding keys", expected, actual);
}
protected void assertBindingEquals(String expected, IBinding binding) {
- assertBindingsEqual(expected, new IBinding[] {binding});
+ assertBindingsEqual(expected, new IBinding[] { binding });
}
-
- protected void assertBindingsEqual(String expected, IBinding[] actualBindings) {
+
+ protected void assertBindingsEqual(String expected,
+ IBinding[] actualBindings) {
StringBuffer buffer = new StringBuffer();
for (int i = 0, length = actualBindings.length; i < length; i++) {
- if (i > 0) buffer.append('\n');
+ if (i > 0)
+ buffer.append('\n');
if (actualBindings[i] == null)
buffer.append("<null>");
else
@@ -216,75 +218,92 @@
System.out.print(displayString(actual, 3));
System.out.println(',');
}
- assertEquals(
- "Unexpected bindings",
- expected,
- actual);
+ assertEquals("Unexpected bindings", expected, actual);
}
/*
- * Builds an AST from the info source (which is assumed to be the source attached to the given class file),
- * and returns the AST node that was delimited by the astStart and astEnd of the marker info.
+ * Builds an AST from the info source (which is assumed to be the source
+ * attached to the given class file), and returns the AST node that was
+ * delimited by the astStart and astEnd of the marker info.
*/
- protected ASTNode buildAST(MarkerInfo markerInfo, IClassFile classFile, boolean reportErrors) throws JavaScriptModelException {
+ protected ASTNode buildAST(MarkerInfo markerInfo, IClassFile classFile,
+ boolean reportErrors) throws JavaScriptModelException {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(classFile);
parser.setResolveBindings(true);
JavaScriptUnit unit = (JavaScriptUnit) parser.createAST(null);
-
+
if (reportErrors) {
StringBuffer buffer = new StringBuffer();
IProblem[] problems = unit.getProblems();
for (int i = 0, length = problems.length; i < length; i++)
- Util.appendProblem(buffer, problems[i], markerInfo.source.toCharArray(), i+1);
+ Util.appendProblem(buffer, problems[i], markerInfo.source
+ .toCharArray(), i + 1);
if (buffer.length() > 0)
System.err.println(buffer.toString());
}
return findNode(unit, markerInfo);
}
-
- protected ASTNode buildAST(IJavaScriptUnit cu) throws JavaScriptModelException {
- return buildAST(null/*use existing contents*/, cu, true/*report errors*/);
+
+ protected ASTNode buildAST(IJavaScriptUnit cu)
+ throws JavaScriptModelException {
+ return buildAST(null/* use existing contents */, cu, true/* report errors */);
}
- protected ASTNode buildAST(String newContents, IJavaScriptUnit cu) throws JavaScriptModelException {
- return buildAST(newContents, cu, true/*report errors*/);
+ protected ASTNode buildAST(String newContents, IJavaScriptUnit cu)
+ throws JavaScriptModelException {
+ return buildAST(newContents, cu, true/* report errors */);
}
-
- protected ASTNode buildAST(MarkerInfo markerInfo, IClassFile classFile) throws JavaScriptModelException {
- return buildAST(markerInfo, classFile, true/*report errors*/);
+
+ protected ASTNode buildAST(MarkerInfo markerInfo, IClassFile classFile)
+ throws JavaScriptModelException {
+ return buildAST(markerInfo, classFile, true/* report errors */);
}
/*
- * Removes the marker comments "*start*" and "*end*" from the given contents,
- * builds an AST from the resulting source, and returns the AST node that was delimited
- * by "*start*" and "*end*".
+ * Removes the marker comments "*start*" and "*end*" from the given
+ * contents, builds an AST from the resulting source, and returns the AST
+ * node that was delimited by "*start*" and "*end*".
*/
- protected ASTNode buildAST(String newContents, IJavaScriptUnit cu, boolean reportErrors) throws JavaScriptModelException {
- return buildAST(newContents, cu, reportErrors, false/*no statement recovery*/);
+ protected ASTNode buildAST(String newContents, IJavaScriptUnit cu,
+ boolean reportErrors) throws JavaScriptModelException {
+ return buildAST(newContents, cu, reportErrors, false/*
+ * no statement
+ * recovery
+ */);
}
- protected ASTNode buildAST(String newContents, IJavaScriptUnit cu, boolean reportErrors, boolean enableStatementRecovery) throws JavaScriptModelException {
- ASTNode[] nodes = buildASTs(newContents, cu, reportErrors, enableStatementRecovery);
- if (nodes.length == 0) return null;
- return nodes[0];
- }
- protected ASTNode[] buildASTs(String contents, IJavaScriptUnit cu) throws JavaScriptModelException {
+ protected ASTNode buildAST(String newContents, IJavaScriptUnit cu,
+ boolean reportErrors, boolean enableStatementRecovery)
+ throws JavaScriptModelException {
+ ASTNode[] nodes = buildASTs(newContents, cu, reportErrors,
+ enableStatementRecovery);
+ if (nodes.length == 0)
+ return null;
+ return nodes[0];
+ }
+
+ protected ASTNode[] buildASTs(String contents, IJavaScriptUnit cu)
+ throws JavaScriptModelException {
return buildASTs(contents, cu, true);
}
/*
- * Removes the marker comments "*start?*" and "*end?*" from the given new contents
- * (where ? is either empty or a number), or use the current contents if the given new contents is null.
- * Builds an AST from the resulting source.
- * For each of the pairs, returns the AST node that was delimited by "*start?*" and "*end?*".
+ * Removes the marker comments "*start?*" and "*end?*" from the given new
+ * contents (where ? is either empty or a number), or use the current
+ * contents if the given new contents is null. Builds an AST from the
+ * resulting source. For each of the pairs, returns the AST node that was
+ * delimited by "*start?*" and "*end?*".
*/
- protected ASTNode[] buildASTs(String newContents, IJavaScriptUnit cu, boolean reportErrors) throws JavaScriptModelException {
+ protected ASTNode[] buildASTs(String newContents, IJavaScriptUnit cu,
+ boolean reportErrors) throws JavaScriptModelException {
return buildASTs(newContents, cu, reportErrors, false);
}
-
- protected ASTNode[] buildASTs(String newContents, IJavaScriptUnit cu, boolean reportErrors, boolean enableStatementRecovery) throws JavaScriptModelException {
+
+ protected ASTNode[] buildASTs(String newContents, IJavaScriptUnit cu,
+ boolean reportErrors, boolean enableStatementRecovery)
+ throws JavaScriptModelException {
MarkerInfo markerInfo;
if (newContents == null) {
markerInfo = new MarkerInfo(cu.getSource());
@@ -296,34 +315,35 @@
JavaScriptUnit unit;
if (cu.isWorkingCopy()) {
cu.getBuffer().setContents(newContents);
- unit = cu.reconcile(AST.JLS3, reportErrors, enableStatementRecovery, null, null);
+ unit = cu.reconcile(AST.JLS3, reportErrors,
+ enableStatementRecovery, null, null);
} else {
IBuffer buffer = cu.getBuffer();
buffer.setContents(newContents);
buffer.save(null, false);
-
+
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(cu);
parser.setResolveBindings(true);
parser.setStatementsRecovery(enableStatementRecovery);
unit = (JavaScriptUnit) parser.createAST(null);
}
-
+
if (reportErrors) {
StringBuffer buffer = new StringBuffer();
IProblem[] problems = unit.getProblems();
for (int i = 0, length = problems.length; i < length; i++)
- Util.appendProblem(buffer, problems[i], newContents.toCharArray(), i+1);
+ Util.appendProblem(buffer, problems[i], newContents
+ .toCharArray(), i + 1);
if (buffer.length() > 0)
System.err.println(buffer.toString());
}
ASTNode[] nodes = findNodes(unit, markerInfo);
if (nodes.length == 0)
- return new ASTNode[] {unit};
+ return new ASTNode[] { unit };
return nodes;
}
-
protected MarkerInfo[] createMarkerInfos(String[] pathAndSources) {
MarkerInfo[] markerInfos = new MarkerInfo[pathAndSources.length / 2];
@@ -336,22 +356,31 @@
return markerInfos;
}
- protected IVariableBinding[] createVariableBindings(String[] pathAndSources, String[] bindingKeys) throws JavaScriptModelException {
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
+ protected IVariableBinding[] createVariableBindings(
+ String[] pathAndSources, String[] bindingKeys)
+ throws JavaScriptModelException {
+ WorkingCopyOwner owner = new WorkingCopyOwner() {
+ };
this.workingCopies = createWorkingCopies(pathAndSources, owner);
- IBinding[] bindings = resolveBindings(bindingKeys, getJavaProject("P"), owner);
+ IBinding[] bindings = resolveBindings(bindingKeys, getJavaProject("P"),
+ owner);
int length = bindings.length;
IVariableBinding[] result = new IVariableBinding[length];
System.arraycopy(bindings, 0, result, 0, length);
return result;
}
- protected IFunctionBinding[] createMethodBindings(String[] pathAndSources, String[] bindingKeys) throws JavaScriptModelException {
- return createMethodBindings(pathAndSources, bindingKeys, getJavaProject("P"));
+ protected IFunctionBinding[] createMethodBindings(String[] pathAndSources,
+ String[] bindingKeys) throws JavaScriptModelException {
+ return createMethodBindings(pathAndSources, bindingKeys,
+ getJavaProject("P"));
}
- protected IFunctionBinding[] createMethodBindings(String[] pathAndSources, String[] bindingKeys, IJavaScriptProject project) throws JavaScriptModelException {
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
+ protected IFunctionBinding[] createMethodBindings(String[] pathAndSources,
+ String[] bindingKeys, IJavaScriptProject project)
+ throws JavaScriptModelException {
+ WorkingCopyOwner owner = new WorkingCopyOwner() {
+ };
this.workingCopies = createWorkingCopies(pathAndSources, owner);
IBinding[] bindings = resolveBindings(bindingKeys, project, owner);
int length = bindings.length;
@@ -360,12 +389,17 @@
return result;
}
- protected ITypeBinding[] createTypeBindings(String[] pathAndSources, String[] bindingKeys) throws JavaScriptModelException {
- return createTypeBindings(pathAndSources, bindingKeys, getJavaProject("P"));
+ protected ITypeBinding[] createTypeBindings(String[] pathAndSources,
+ String[] bindingKeys) throws JavaScriptModelException {
+ return createTypeBindings(pathAndSources, bindingKeys,
+ getJavaProject("P"));
}
-
- protected ITypeBinding[] createTypeBindings(String[] pathAndSources, String[] bindingKeys, IJavaScriptProject project) throws JavaScriptModelException {
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
+
+ protected ITypeBinding[] createTypeBindings(String[] pathAndSources,
+ String[] bindingKeys, IJavaScriptProject project)
+ throws JavaScriptModelException {
+ WorkingCopyOwner owner = new WorkingCopyOwner() {
+ };
this.workingCopies = createWorkingCopies(pathAndSources, owner);
IBinding[] bindings = resolveBindings(bindingKeys, project, owner);
int length = bindings.length;
@@ -374,44 +408,55 @@
return result;
}
- protected IJavaScriptUnit[] createWorkingCopies(String[] pathAndSources, WorkingCopyOwner owner) throws JavaScriptModelException {
+ protected IJavaScriptUnit[] createWorkingCopies(String[] pathAndSources,
+ WorkingCopyOwner owner) throws JavaScriptModelException {
MarkerInfo[] markerInfos = createMarkerInfos(pathAndSources);
return createWorkingCopies(markerInfos, owner);
}
-
- protected IJavaScriptUnit[] createWorkingCopies(MarkerInfo[] markerInfos, WorkingCopyOwner owner) throws JavaScriptModelException {
+
+ protected IJavaScriptUnit[] createWorkingCopies(MarkerInfo[] markerInfos,
+ WorkingCopyOwner owner) throws JavaScriptModelException {
return createWorkingCopies(markerInfos, owner, null);
}
- protected IJavaScriptUnit[] createWorkingCopies(MarkerInfo[] markerInfos, WorkingCopyOwner owner, IProblemRequestor problemRequestor) throws JavaScriptModelException {
+ protected IJavaScriptUnit[] createWorkingCopies(MarkerInfo[] markerInfos,
+ WorkingCopyOwner owner, IProblemRequestor problemRequestor)
+ throws JavaScriptModelException {
int length = markerInfos.length;
IJavaScriptUnit[] copies = new IJavaScriptUnit[length];
for (int i = 0; i < length; i++) {
MarkerInfo markerInfo = markerInfos[i];
- IJavaScriptUnit workingCopy = getCompilationUnit(markerInfo.path).getWorkingCopy(owner, problemRequestor, null);
+ IJavaScriptUnit workingCopy = getCompilationUnit(markerInfo.path)
+ .getWorkingCopy(owner, null);
workingCopy.getBuffer().setContents(markerInfo.source);
workingCopy.makeConsistent(null);
copies[i] = workingCopy;
}
return copies;
}
-
+
protected ASTNode findNode(JavaScriptUnit unit, final MarkerInfo markerInfo) {
ASTNode[] nodes = findNodes(unit, markerInfo);
if (nodes.length == 0)
return unit;
return nodes[0];
}
-
- protected ASTNode[] findNodes(JavaScriptUnit unit, final MarkerInfo markerInfo) {
+
+ protected ASTNode[] findNodes(JavaScriptUnit unit,
+ final MarkerInfo markerInfo) {
class Visitor extends ASTVisitor {
ArrayList found = new ArrayList();
+
public void preVisit(ASTNode node) {
- if (node instanceof JavaScriptUnit) return;
+ if (node instanceof JavaScriptUnit)
+ return;
int index = markerInfo.indexOfASTStart(node.getStartPosition());
- if (index != -1 && node.getStartPosition() + node.getLength() == markerInfo.astEnds[index]) {
+ if (index != -1
+ && node.getStartPosition() + node.getLength() == markerInfo.astEnds[index]) {
this.found.add(node);
- markerInfo.astStarts[index] = -1; // so that 2 nodes with the same start and end will not be found
+ markerInfo.astStarts[index] = -1; // so that 2 nodes with
+ // the same start and
+ // end will not be found
}
}
}
@@ -423,68 +468,70 @@
return result;
}
- protected void resolveASTs(IJavaScriptUnit[] cus, String[] bindingKeys, ASTRequestor requestor, IJavaScriptProject project, WorkingCopyOwner owner) {
+ protected void resolveASTs(IJavaScriptUnit[] cus, String[] bindingKeys,
+ ASTRequestor requestor, IJavaScriptProject project,
+ WorkingCopyOwner owner) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setResolveBindings(true);
parser.setProject(project);
parser.setWorkingCopyOwner(owner);
- parser.createASTs(cus, bindingKeys, requestor, null);
+ parser.createASTs(cus, bindingKeys, requestor, null);
}
-
+
protected IBinding resolveBinding(ASTNode node) {
switch (node.getNodeType()) {
- case ASTNode.PACKAGE_DECLARATION:
- return ((PackageDeclaration) node).resolveBinding();
- case ASTNode.TYPE_DECLARATION:
- return ((TypeDeclaration) node).resolveBinding();
- case ASTNode.ANONYMOUS_CLASS_DECLARATION:
- return ((AnonymousClassDeclaration) node).resolveBinding();
- case ASTNode.TYPE_DECLARATION_STATEMENT:
- return ((TypeDeclarationStatement) node).resolveBinding();
- case ASTNode.FUNCTION_DECLARATION:
- return ((FunctionDeclaration) node).resolveBinding();
- case ASTNode.FUNCTION_INVOCATION:
- return ((FunctionInvocation) node).resolveMethodBinding();
- case ASTNode.TYPE_PARAMETER:
- return ((TypeParameter) node).resolveBinding();
- case ASTNode.PARAMETERIZED_TYPE:
- return ((ParameterizedType) node).resolveBinding();
- case ASTNode.WILDCARD_TYPE:
- return ((WildcardType) node).resolveBinding();
- case ASTNode.SIMPLE_NAME:
- return ((SimpleName) node).resolveBinding();
- case ASTNode.ARRAY_TYPE:
- return ((ArrayType) node).resolveBinding();
- case ASTNode.ASSIGNMENT:
- return ((Assignment) node).getRightHandSide().resolveTypeBinding();
- case ASTNode.SIMPLE_TYPE:
- return ((SimpleType) node).resolveBinding();
- case ASTNode.QUALIFIED_NAME:
- return ((QualifiedName) node).resolveBinding();
- default:
- throw new Error("Not yet implemented for this type of node: " + node);
+ case ASTNode.PACKAGE_DECLARATION:
+ return ((PackageDeclaration) node).resolveBinding();
+ case ASTNode.TYPE_DECLARATION:
+ return ((TypeDeclaration) node).resolveBinding();
+ case ASTNode.ANONYMOUS_CLASS_DECLARATION:
+ return ((AnonymousClassDeclaration) node).resolveBinding();
+ case ASTNode.TYPE_DECLARATION_STATEMENT:
+ return ((TypeDeclarationStatement) node).resolveBinding();
+ case ASTNode.FUNCTION_DECLARATION:
+ return ((FunctionDeclaration) node).resolveBinding();
+ case ASTNode.FUNCTION_INVOCATION:
+ return ((FunctionInvocation) node).resolveMethodBinding();
+ case ASTNode.SIMPLE_NAME:
+ return ((SimpleName) node).resolveBinding();
+ case ASTNode.ARRAY_TYPE:
+ return ((ArrayType) node).resolveBinding();
+ case ASTNode.ASSIGNMENT:
+ return ((Assignment) node).getRightHandSide().resolveTypeBinding();
+ case ASTNode.SIMPLE_TYPE:
+ return ((SimpleType) node).resolveBinding();
+ case ASTNode.QUALIFIED_NAME:
+ return ((QualifiedName) node).resolveBinding();
+ default:
+ throw new Error("Not yet implemented for this type of node: "
+ + node);
}
}
-
- protected IBinding[] resolveBindings(String[] bindingKeys, IJavaScriptProject project, WorkingCopyOwner owner) {
+
+ protected IBinding[] resolveBindings(String[] bindingKeys,
+ IJavaScriptProject project, WorkingCopyOwner owner) {
BindingRequestor requestor = new BindingRequestor();
- resolveASTs(new IJavaScriptUnit[0], bindingKeys, requestor, project, owner);
+ resolveASTs(new IJavaScriptUnit[0], bindingKeys, requestor, project,
+ owner);
return requestor.getBindings(bindingKeys);
}
-
- /*
- * Resolve the bindings of the nodes marked with *start?* and *end?*.
- */
- protected IBinding[] resolveBindings(String contents, IJavaScriptUnit cu) throws JavaScriptModelException {
- return resolveBindings(contents, cu, true/*report errors*/);
- }
/*
* Resolve the bindings of the nodes marked with *start?* and *end?*.
*/
- protected IBinding[] resolveBindings(String contents, IJavaScriptUnit cu, boolean reportErrors) throws JavaScriptModelException {
+ protected IBinding[] resolveBindings(String contents, IJavaScriptUnit cu)
+ throws JavaScriptModelException {
+ return resolveBindings(contents, cu, true/* report errors */);
+ }
+
+ /*
+ * Resolve the bindings of the nodes marked with *start?* and *end?*.
+ */
+ protected IBinding[] resolveBindings(String contents, IJavaScriptUnit cu,
+ boolean reportErrors) throws JavaScriptModelException {
ASTNode[] nodes = buildASTs(contents, cu, reportErrors);
- if (nodes == null) return null;
+ if (nodes == null)
+ return null;
int length = nodes.length;
IBinding[] result = new IBinding[length];
for (int i = 0; i < length; i++) {
@@ -493,10 +540,9 @@
return result;
}
-
-// protected void tearDown() throws Exception {
-// discardWorkingCopies(this.workingCopies);
-// this.workingCopies = null;
-// }
-
+ // protected void tearDown() throws Exception {
+ // discardWorkingCopies(this.workingCopies);
+ // this.workingCopies = null;
+ // }
+
}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java
index f6a1978..750065c 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ConverterTestSetup.java
@@ -95,18 +95,9 @@
}
protected IPath getConverterJCLPath(String compliance) {
-// return new Path(getExternalPath() + "converterJclMin" + compliance + ".jar"); //$NON-NLS-1$
return new Path(new SystemLibraryLocation().getLibraryPath("system.js"));
}
- protected IPath getConverterJCLSourcePath() {
- return getConverterJCLSourcePath(""); //$NON-NLS-1$
- }
-
- protected IPath getConverterJCLSourcePath(String compliance) {
- return new Path(getExternalPath() + "converterJclMin" + compliance + "src.zip"); //$NON-NLS-1$
- }
-
protected IPath getConverterJCLRootSourcePath() {
return new Path(""); //$NON-NLS-1$
}
@@ -118,36 +109,22 @@
ast = null;
if (TEST_SUITES == null) {
this.deleteProject("Converter"); //$NON-NLS-1$
- this.deleteProject("Converter15"); //$NON-NLS-1$
} else {
TEST_SUITES.remove(getClass());
if (TEST_SUITES.size() == 0) {
this.deleteProject("Converter"); //$NON-NLS-1$
- this.deleteProject("Converter15"); //$NON-NLS-1$
}
}
-
super.tearDown();
}
- public void setUpJCLClasspathVariables(String compliance) throws JavaScriptModelException, IOException {
- if ("1.5".equals(compliance)) {
- if (JavaScriptCore.getIncludepathVariable("CONVERTER_JCL15_LIB") == null) {
-// setupExternalJCL("converterJclMin1.5");
- JavaScriptCore.setIncludepathVariables(
- new String[] {"CONVERTER_JCL15_LIB", "CONVERTER_JCL15_SRC", "CONVERTER_JCL15_SRCROOT"},
- new IPath[] {getConverterJCLPath(compliance), getConverterJCLSourcePath(compliance), getConverterJCLRootSourcePath()},
- null);
- }
- } else {
- if (JavaScriptCore.getIncludepathVariable("CONVERTER_JCL_LIB") == null) {
-// setupExternalJCL("converterJclMin");
- JavaScriptCore.setIncludepathVariables(
- new String[] {"CONVERTER_JCL_LIB", "CONVERTER_JCL_SRC", "CONVERTER_JCL_SRCROOT"},
- new IPath[] {getConverterJCLPath(), getConverterJCLSourcePath(), getConverterJCLRootSourcePath()},
- null);
- }
- }
+ public void setUpJCLClasspathVariables() throws JavaScriptModelException, IOException {
+ if (JavaScriptCore.getIncludepathVariable("CONVERTER_JCL_LIB") == null) {
+ JavaScriptCore.setIncludepathVariables(
+ new String[] {"CONVERTER_JCL_LIB", "CONVERTER_JCL_SRCROOT"},
+ new IPath[] {getConverterJCLPath(), getConverterJCLRootSourcePath()},
+ null);
+ }
}
/**
@@ -158,7 +135,6 @@
if (!PROJECT_SETUP) {
setUpJavaProject("Converter"); //$NON-NLS-1$
- setUpJavaProject("Converter15", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$
waitUntilIndexesReady(); // needed to find secondary types
PROJECT_SETUP = true;
}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java
index 5f64d54..af8f0ec 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/RunConverterTests.java
@@ -28,7 +28,6 @@
ASTConverterTest.class,
ASTConverterTest2.class,
ASTConverterJavadocTest.class,
- ASTConverter15Test.class,
ASTConverterAST3Test.class,
ASTConverterTestAST3_2.class,
ASTConverterBindingsTest.class,
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java
index 50d2ba5..0aa449e 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java
@@ -731,10 +731,6 @@
assertEquals("wrong token", "unqualified-field-access",
CorrectionEngine
.getWarningToken(IProblem.UnqualifiedFieldAccess));
- assertEquals("wrong token", "unchecked", CorrectionEngine
- .getWarningToken(IProblem.UnsafeTypeConversion));
- assertEquals("wrong token", "unchecked", CorrectionEngine
- .getWarningToken(IProblem.UnsafeReturnTypeOverride));
assertEquals("wrong token", "serial", CorrectionEngine
.getWarningToken(IProblem.MissingSerialVersion));
}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0001/Test.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0001/Test.js
index c5df6af..637eb4e 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0001/Test.js
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0001/Test.js
@@ -1,3 +1,3 @@
- function main(args) {
- System.out.println("Hello" + " world");
- }
+function main(args) {
+ print("Hello" + " world");
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0002/Test.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0002/Test.js
index aab5816..6129f7b 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0002/Test.js
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0002/Test.js
@@ -1,3 +1,3 @@
- function main(args) {
- System.out.println(new Object());
- }
+function main(args) {
+ print(new Object());
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/.classpath b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/.classpath
deleted file mode 100644
index 474fab1..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="CONVERTER_JCL15_LIB" sourcepath="CONVERTER_JCL15_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
- <classpathentry kind="output" path="bin"/>
- <classpathentry kind="lib" sourcepath="src" path="bins"/>
-</classpath>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/.project b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/.project
deleted file mode 100644
index 75574e7..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.jsdt.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.jsdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/bins/binaries.jar b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/bins/binaries.jar
deleted file mode 100644
index fbcb8bf..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/bins/binaries.jar
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804/Test.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804/Test.js
deleted file mode 100644
index 4cf00e2..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804/Test.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package javadoc.b83804;
-public class Test {
- public int field;
- public void foo() {}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804/package-info.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804/package-info.js
deleted file mode 100644
index b248cd4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804/package-info.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Valid javadoc.
- * @see Test
- * @see Unknown Unknown
- * @see Test#foo()
- * @see Test#unknown() Unknown
- * @see Test#field
- * @see Test#unknown Unknown
- * @param unexpected Unknown
- * @throws unexpected Unknown
- * @return unexpected
- * @deprecated unexpected in spec, but accepted by javadoc.exe
- * @other-tags should be valid
- */
-package javadoc.b83804;
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804a/Test.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804a/Test.js
deleted file mode 100644
index b407ba7..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804a/Test.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package javadoc.b83804a;
-public class Test {
- public int field;
- public void foo() {}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804a/package-info.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804a/package-info.js
deleted file mode 100644
index 4e40699..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/javadoc/b83804a/package-info.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Valid javadoc.
- * @see Test
- * @see Unknown Unknown
- * @see Test#foo()
- * @see Test#unknown() Unknown
- * @see Test#field
- * @see Test#unknown Unknown
- * @param unexpected Unknown
- * @throws unexpected Unknown
- * @return unexpected
- * @deprecated unexpected in spec, but accepted by javadoc.exe
- * @other-tags should be valid
- */
-@Deprecated
-package javadoc.b83804a;
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A1.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A1.js
deleted file mode 100644
index 9beff64..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A1.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package pack;
-
-
-public @interface A1 {
- E value();
- E[] list();
- Class clazz();
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A2.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A2.js
deleted file mode 100644
index e0e2d51..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A2.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package pack;
-
-
-public @interface A2 {
- A1 annot();
- E value();
- E[] list();
- Class clazz();
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A3.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A3.js
deleted file mode 100644
index 7d85362..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/A3.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package pack;
-
-
-public @interface A3 {
- A2 annot();
- E value();
- E[] list();
- Class clazz();
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/E.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/E.js
deleted file mode 100644
index 695bcee..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/pack/E.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package pack;
-
-
-public enum E {
- // constants used in value field of annotations
- CC, CF, CM, CP, CV,
- // constants used in list field of annotations
- CAC, CAF, CAM, CAP, CAV,
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0001/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0001/X.js
deleted file mode 100644
index aee69a4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0001/X.js
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0001;
-
-public class X {
-
- public static final String HELLO_WORLD = "Hello" + " world";
-
- private static String bar(final String s) {
- return s;
- }
- public static void main(String[] args) {
- System.out.println(bar(HELLO_WORLD));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0002/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0002/X.js
deleted file mode 100644
index 7e4869e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0002/X.js
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0002;
-
-public @interface X {
- String first();
- String last();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0003/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0003/X.js
deleted file mode 100644
index 84ac705..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0003/X.js
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0003;
-
-@interface Name {
- String first();
- String last();
-}
-
-@interface Author {
- Name value();
-}
-
-@Author(@Name(first="Joe", last="Hacker"))
-
-public class X {}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0004/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0004/X.js
deleted file mode 100644
index d62aebd..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0004/X.js
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0004;
-
-@interface Name {
- String first();
- String last();
-}
-
-@interface Author {
- Name value();
-}
-
-public @Author(@Name(first="Joe", last="Hacker"))
-class X {}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0005/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0005/X.js
deleted file mode 100644
index 7791047..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0005/X.js
+++ /dev/null
@@ -1,17 +0,0 @@
-package test0005;
-
-@interface Name {
- String first() default "Joe";
- String last() default "Smith";
- int age();
-}
-
-@interface Author {
- Name value();
-}
-
-@interface Retention {
-}
-
-@Retention public @Author(@Name(first="Joe", last="Hacker", age=32))
-class X {}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0006/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0006/X.js
deleted file mode 100644
index 16920e5..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0006/X.js
+++ /dev/null
@@ -1,17 +0,0 @@
-@Retention package test0006;
-
-@interface Name {
- String first() default "Joe";
- String last() default "Smith";
- int age();
-}
-
-@interface Author {
- Name value();
-}
-
-@interface Retention {
-}
-
-@Retention() @Author(@Name(first="Joe", last="Hacker", age=32))
-class X {}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0007/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0007/X.js
deleted file mode 100644
index 5d27cc8..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0007/X.js
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0007;
-
-import java.util.*;
-import static java.io.File.*;
-
-public class X {
- Map<String, String> foo() {
- return null;
- }
-
- char bar() {
- return separatorChar;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0008/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0008/X.js
deleted file mode 100644
index 0c46a1a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0008/X.js
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0008;
-
-import java.util.*;
-import static java.io.File.*;
-
-public class X {
- Map<String, String> foo() {
- return null;
- }
-
- char bar() {
- return separatorChar;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0009/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0009/X.js
deleted file mode 100644
index ff75bcc..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0009/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0009;
-
-public class X {
-
- public static void main(String[] args) {
- for (String s : args) {System.out.println(s);}
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0010/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0010/X.js
deleted file mode 100644
index 2bbc5b2..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0010/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0010;
-
-@interface Foo {
-}
-
-public class X {
-
- public static void main(String[] args) {
- for (@Foo final String s : args) {System.out.println(s);}
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0011/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0011/X.js
deleted file mode 100644
index 87a912a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0011/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0011;
-
-@interface Foo {
-}
-
-public class X {
-
- public void bar(String[][] args) {
- for (@Foo final String s[] : args) {System.out.println(s);}
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0012/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0012/X.js
deleted file mode 100644
index 87edab2..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0012/X.js
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0012;
-
-@interface Foo {
-}
-
-public class X {
-
- public void bar(@Foo final String[][]... args) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0013/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0013/X.js
deleted file mode 100644
index b79302b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0013/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0013;
-
-interface Convertible<T> {
- T convert();
-}
-
-public class X<A extends Convertible<B>, B extends Convertible<A>> {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0014/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0014/X.js
deleted file mode 100644
index a2d4d7f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0014/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0014;
-
-interface Convertible<T> {
- T convert();
-}
-
-public class X<A extends Convertible<Convertible<A>>> {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0015/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0015/X.js
deleted file mode 100644
index e955f3d..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0015/X.js
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0015;
-
-public class X<A extends Object & java.io.Serializable & Comparable<?>> {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0016/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0016/X.js
deleted file mode 100644
index 1c34ad2..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0016/X.js
+++ /dev/null
@@ -1,82 +0,0 @@
-package test0016;
-
-class Seq<E> {
- E head;
- Seq<E> tail;
- Seq() {
- this(null, null);
- }
- boolean isEmpty() {
- return this.tail == null;
- }
- Seq(E head, Seq<E> tail) {
- this.head = head;
- this.tail = tail;
- }
- <T> Seq<Pair<E,T>> zip(Seq<T> that) {
- if (this.isEmpty() || that.isEmpty())
- return new Seq<Pair<E,T>>();
- else
- return new Seq<Pair<E,T>>(
- new Pair<E,T>(this.head, that.head),
- this.tail.zip(that.tail));
- }
- @Override
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- if (head != null) {
- buffer.append(head);
- }
- if (tail != null) {
- buffer.append(tail);
- }
- return String.valueOf(buffer);
- }
- public class Zipper<T> {
- Seq<Pair<E,T>> zip(Seq<T> that) {
- if (Seq.this.isEmpty() || that.isEmpty())
- return new Seq<Pair<E,T>>();
- else
- return new Seq<Pair<E,T>>(
- new Pair<E,T>(Seq.this.head, that.head),
- Seq.this.tail.zip(that.tail));
- }
- }
-}
-class Pair<A, B> {
- A fst;
- B snd;
-
- Pair(A a, B b) {
- this.fst = a;
- this.snd = b;
- }
- @Override
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("(");
- buffer.append(fst);
- buffer.append(", ");
- buffer.append(snd);
- buffer.append(")");
- return String.valueOf(buffer);
- }
- @Override
- public boolean equals(Object other) {
- return other instanceof Pair &&
- equals(fst, ((Pair)other).fst) &&
- equals(snd, ((Pair)other).snd);
- }
- private boolean equals(Object x, Object y) {
- return x == null && y == null || x != null && x.equals(y);
- }
-}
-public class X {
- public static void main(String[] args) {
- Seq<String> strs = new Seq<String>("a", new Seq<String>("b", new Seq<String>()));
- Seq<Number> nums = new Seq<Number>(new Integer(1), new Seq<Number>(new Double(1.5), new Seq<Number>()));
- Seq<String>.Zipper<Number> zipper = strs.new Zipper<Number>();
- Seq<Pair<String,Number>> combined = zipper.zip(nums);
- System.out.println(combined);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0017/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0017/X.js
deleted file mode 100644
index 955412c..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0017/X.js
+++ /dev/null
@@ -1,30 +0,0 @@
-package test0017;
-
-class A<E> {
- E e;
-
- A(E e) {
- this.e = e;
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.e);
- }
- class B<T> {
- T t;
- B(T t) {
- this.t = t;
- }
- @Override
- public String toString() {
- return String.valueOf(this.t);
- }
- }
-}
-public class X {
- public static void main(String[] args) {
- test0017.A<String>.B<Integer> o = new test0017.A<String>("Hello").new B<Integer>(new Integer(1));
- System.out.println(o);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0018/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0018/X.js
deleted file mode 100644
index ead3a18..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0018/X.js
+++ /dev/null
@@ -1,41 +0,0 @@
-package test0018;
-
-class A<E> {
- E e;
-
- A(E e) {
- this.e = e;
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.e);
- }
- class B {
- Integer t;
- B(Integer t) {
- this.t = t;
- }
- @Override
- public String toString() {
- return String.valueOf(this.t);
- }
-
- class C<Z> {
- Z z;
- C(Z z) {
- this.z = z;
- }
- @Override
- public String toString() {
- return String.valueOf(this.z);
- }
- }
- }
-}
-public class X {
- public static void main(String[] args) {
- test0018.A<String>.B.C<Float> o = new test0018.A<String>("Hello").new B(new Integer(1)).new C<Float>(new Float(1.2f));
- System.out.println(o);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0019/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0019/X.js
deleted file mode 100644
index 4caf36b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0019/X.js
+++ /dev/null
@@ -1,41 +0,0 @@
-package test0019;
-
-class A<E> {
- E e;
-
- A(E e) {
- this.e = e;
- }
-
- @Override
- public String toString() {
- return String.valueOf(this.e);
- }
- class B<T> {
- T t;
- B(T t) {
- this.t = t;
- }
- @Override
- public String toString() {
- return String.valueOf(this.t);
- }
-
- class C {
- Float z;
- C(Float z) {
- this.z = z;
- }
- @Override
- public String toString() {
- return String.valueOf(this.z);
- }
- }
- }
-}
-public class X {
- public static void main(String[] args) {
- test0019.A<String>.B<Integer>.C o = new test0019.A<String>("Hello").new B<Integer>(new Integer(1)).new C(new Float(1.2f));
- System.out.println(o);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0020/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0020/X.js
deleted file mode 100644
index 17dae31..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0020/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0020;
-
-public class X<E> {
-
- public void foo(X<?> x) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0021/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0021/X.js
deleted file mode 100644
index 66d6e3a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0021/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0021;
-
-public class X<E> {
-
- public void foo(X<? extends E> x) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0022/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0022/X.js
deleted file mode 100644
index 6de71df..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0022/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0022;
-
-public class X<E> {
-
- public void foo(X<? super E> x) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0023/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0023/X.js
deleted file mode 100644
index ba7e8ab..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0023/X.js
+++ /dev/null
@@ -1,82 +0,0 @@
-package test0023;
-
-class Seq<E> {
- E head;
- Seq<E> tail;
- Seq() {
- this(null, null);
- }
- boolean isEmpty() {
- return this.tail == null;
- }
- Seq(E head, Seq<E> tail) {
- this.head = head;
- this.tail = tail;
- }
- <T> Seq<Pair<E,T>> zip(Seq<T> that) {
- if (this.isEmpty() || that.isEmpty())
- return new Seq<Pair<E,T>>();
- else
- return new Seq<Pair<E,T>>(
- new Pair<E,T>(this.head, that.head),
- this.tail.zip(that.tail));
- }
- @Override
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- if (head != null) {
- buffer.append(head);
- }
- if (tail != null) {
- buffer.append(tail);
- }
- return String.valueOf(buffer);
- }
- public class Zipper<T> {
- Seq<Pair<E,T>> zip(Seq<T> that) {
- if (Seq.this.isEmpty() || that.isEmpty())
- return new Seq<Pair<E,T>>();
- else
- return new Seq<Pair<E,T>>(
- new Pair<E,T>(Seq.this.head, that.head),
- Seq.this.tail.zip(that.tail));
- }
- }
-}
-class Pair<A, B> {
- A fst;
- B snd;
-
- Pair(A a, B b) {
- this.fst = a;
- this.snd = b;
- }
- @Override
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("(");
- buffer.append(fst);
- buffer.append(", ");
- buffer.append(snd);
- buffer.append(")");
- return String.valueOf(buffer);
- }
- @Override
- public boolean equals(Object other) {
- return other instanceof Pair &&
- equals(fst, ((Pair)other).fst) &&
- equals(snd, ((Pair)other).snd);
- }
- private boolean equals(Object x, Object y) {
- return x == null && y == null || x != null && x.equals(y);
- }
-}
-public class X {
- public static void main(String[] args) {
- Seq<String> strs = new Seq<String>("a", new Seq<String>("b", new Seq<String>()));
- Seq<Number> nums = new Seq<Number>(new Integer(1), new Seq<Number>(new Double(1.5), new Seq<Number>()));
- Seq<String>.Zipper<Number> zipper = strs.new Zipper<Number>();
- Seq<Pair<String,Number>> combined = zipper.zip(nums);
- System.out.println(combined);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0024/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0024/X.js
deleted file mode 100644
index 96b1f22..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0024/X.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0024;
-
-public class X<E> {
-
- <E> X() {
- }
-
- public static void main(String[] args) {
- X<String> x = new <String> X<String>();
- System.out.println(x);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0025/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0025/X.js
deleted file mode 100644
index b7b2aff..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0025/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0025;
-
-public class X<E> {
-
- <E> X(E e) {
- <E> this();
- }
-
- <E> X() {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0026/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0026/X.js
deleted file mode 100644
index 44ea1a6..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0026/X.js
+++ /dev/null
@@ -1,39 +0,0 @@
-package test0026;
-
-public enum X {
- PLUS {
- @Override
- double eval(double x, double y) { return x + y; }
- } // comment
- ,
-
- MINUS {
- @Override
- double eval(double x, double y) { return x - y; }
- },
-
- TIMES {
- @Override
- double eval(double x, double y) { return x * y; }
- },
-
- DIVIDED_BY {
- @Override
- double eval(double x, double y) { return x / y; }
- };
-
- // Perform the arithmetic X represented by this constant
- abstract double eval(double x, double y);
-
- public static void main(String args[]) {
- if (args.length < 2) {
- System.out.println("Usage: X <double> <double>");
- return;
- }
- double x = Double.parseDouble(args[0]);
- double y = Double.parseDouble(args[1]);
-
- for (X op : X.values())
- System.out.println(x + " " + op + " " + y + " = " + op.eval(x, y));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0027/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0027/X.js
deleted file mode 100644
index 37968e0..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0027/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0027;
-
-public enum X {
- PENNY(1), NICKEL(5), DIME(10), QUARTER(25);
-
- X(int val) { this.val = val; }
-
- private final int val;
-
- public int val() { return val; }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0028/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0028/X.js
deleted file mode 100644
index 909872c..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0028/X.js
+++ /dev/null
@@ -1,25 +0,0 @@
-package test0028;
-
-public abstract class X {
-
- void foo(String[] args) {
- if (args.length < 2) {
- System.out.println("Usage: X <double> <double>");
- return;
- }
- double x = Double.parseDouble(args[0]);
- double y = Double.parseDouble(args[1]);
-
- for (X op : X.values())
- System.out.println(x + " " + op + " " + y + " = " + op.eval(x, y));
- }
-
- // Perform the arithmetic X represented by this constant
- abstract double bar(double x, double y);
-
- static X[] values() {
- return null;
- }
-
- abstract double eval(double x, double y);
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0029/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0029/X.js
deleted file mode 100644
index 3ffc867..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0029/X.js
+++ /dev/null
@@ -1,28 +0,0 @@
-package test0029;
-
-import java.util.Iterator;
-
-interface Predicate<T> {
- boolean is(T t);
-}
-
-interface List<T> {
- List<T> select(Predicate<T> p);
-}
-
-class X<T> implements List<T>, Iterable<T> {
- public List<T> select(Predicate<T> p) {
- X<T> result = new X<T>();
- for (T t : this) {
- if (p.is(t))
- result.add(t);
- }
- return result;
- }
-
- public Iterator<T> iterator() {
- return null;
- }
- void add(T t) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0030/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0030/X.js
deleted file mode 100644
index d01ab49..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0030/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0030;
-
-public class X<T> {
-
- public X(int i) {
- <T>this();
- }
-
- public <T> X() {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0031/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0031/X.js
deleted file mode 100644
index 8693193..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0031/X.js
+++ /dev/null
@@ -1,28 +0,0 @@
-package test0031;
-
-public class X {
- public static class A {
- public class A1 {
- public int foo() {
- return 1;
- }
- }
- public class A2 {
- }
- public int foo() {
- return 2;
- }
- }
-}
-class F {
- public int goo(int param0) {
- class C extends X.A {
- A1 b;
- @Override
- public int foo() {
- return 3;
- }
- }
- return 4;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0032/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0032/X.js
deleted file mode 100644
index 72cba48..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0032/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0032;
-
-interface C<T> {
-}
-
-public abstract class X<T, U> implements C<T> {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0033/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0033/X.js
deleted file mode 100644
index dbfccb1..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0033/X.js
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0033;
-
-interface X {
- enum Location {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0034/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0034/X.js
deleted file mode 100644
index a582ce4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0034/X.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0034;
-
-enum Bar {
- CONSTANT
-}
-
-@interface Foo {
- Bar value();
-}
-
-public @Foo(Bar.CONSTANT) class X {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0035/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0035/X.js
deleted file mode 100644
index d3bae01..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0035/X.js
+++ /dev/null
@@ -1,3 +0,0 @@
-package test0035;
-
-public enum X {ONE, TWO, THREE; }
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0036/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0036/X.js
deleted file mode 100644
index 1bc427f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0036/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0036;
-
-public class X<T> {
-
- public X() {
- this.<T>foo();
- }
-
- public <T> void foo() {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0037/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0037/X.js
deleted file mode 100644
index cf8bc3f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0037/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0037;
-
-public abstract class X<T,U> {
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0038/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0038/X.js
deleted file mode 100644
index ae13f52..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0038/X.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0038;
-
-public class X<T> {
- T x;
- T get(){
- X<T> s= this;
- return x;
- }
- void set(T o1){
- x = o1;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0039/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0039/X.js
deleted file mode 100644
index aa697fe..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0039/X.js
+++ /dev/null
@@ -1,18 +0,0 @@
-package test0039;
-
-import static test0039.Z.*;
-
-enum Z {
- A, B, C, D
-}
-@interface Foo {
- Z[] value();
-}
-@interface Bar {
- Z value();
-}
-@Foo({A, B, C, D})
-@Bar(Z.B)
-public @interface X {
- String[] bar();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0040/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0040/X.js
deleted file mode 100644
index b7fbf1f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0040/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0040;
-
-public class X {
- <T> T foo(){
- return null;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Action.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Action.js
deleted file mode 100644
index 7869941..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Action.js
+++ /dev/null
@@ -1,3 +0,0 @@
-@interface Action {
- Forward[] forwards();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Controller.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Controller.js
deleted file mode 100644
index 349fcc1..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Controller.js
+++ /dev/null
@@ -1 +0,0 @@
-@interface Controller {}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Forward.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Forward.js
deleted file mode 100644
index 03919c6..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/Forward.js
+++ /dev/null
@@ -1,4 +0,0 @@
-@interface Forward {
- String name();
- String path();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/ViewProperties.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/ViewProperties.js
deleted file mode 100644
index 52148a8..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/ViewProperties.js
+++ /dev/null
@@ -1,3 +0,0 @@
-@interface ViewProperties {
- String[] val();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/X.js
deleted file mode 100644
index c38e7a9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0041/X.js
+++ /dev/null
@@ -1,50 +0,0 @@
-package test0041;
-
-class PageFlowController {}
-
-class T {
- T(String s) {}
-}
-/**
- * This is the default controller for a blank web application.
- */
-@test0041.Controller
-@test0041.ViewProperties(
- val = {
- "<!-- This data is auto-generated. Hand-editing this section is not recommended. -->",
- "<view-properties>",
- "<pageflow-object id='action:begin.do'>",
- " <property value='60' name='x'/>",
- " <property value='80' name='y'/>",
- "</pageflow-object>",
- "<pageflow-object id='forward:path#index#index.jsp#@action:begin.do@'>",
- " <property value='96,130,130,164' name='elbowsX'/>",
- " <property value='72,72,72,72' name='elbowsY'/>",
- " <property value='East_1' name='fromPort'/>",
- " <property value='West_1' name='toPort'/>",
- " <property value='index' name='label'/>",
- "</pageflow-object>",
- "<pageflow-object id='page:index.jsp'>",
- " <property value='200' name='x'/>",
- " <property value='80' name='y'/>",
- "</pageflow-object>",
- "<pageflow-object id='page:error.jsp'>",
- " <property value='60' name='x'/>",
- " <property value='180' name='y'/>",
- "</pageflow-object>",
- "</view-properties>"
- }
- )
-public class X
- extends PageFlowController
-{
- @test0041.Action(
- forwards={
- @test0041.Forward(name="success", path="index.jsp")
- }
- )
- protected T begin()
- {
- return new T("success");
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0042/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0042/X.js
deleted file mode 100644
index 176659a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0042/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0042;
-
-public class X {
- <T> T[] foo(){
- return null;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0043/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0043/X.js
deleted file mode 100644
index b8c4aca..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0043/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0043;
-
-public class X<T> {
- void foo(T t) {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0044/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0044/X.js
deleted file mode 100644
index d25d4da..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0044/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0044;
-
-public abstract class X {
- abstract <Z> void foo(Z z);
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0045/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0045/X.js
deleted file mode 100644
index 94b52a0..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0045/X.js
+++ /dev/null
@@ -1,14 +0,0 @@
-package test0045;
-
-class B {
- <Z> void foo(Z z) {
- System.out.println(z);
- }
-}
-
-public class X {
- public static void main(String[] args) {
- B b = new B();
- b.<String>foo("SUCCESS");
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0046/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0046/X.js
deleted file mode 100644
index 52811e3..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0046/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0046;
-
-class B<T> {
-}
-
-public class X extends B<String> {
- B<Integer> val;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0047/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0047/X.js
deleted file mode 100644
index 14d7e09..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0047/X.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0047;
-
-public enum X {
- TOTO ;
-
- private static final long[] overflows = {
- 0, // unused
- Long.MAX_VALUE / 1000,
- Long.MAX_VALUE / (1000 * 1000),
- Long.MAX_VALUE / (1000 * 1000 * 1000)
- };
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0048/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0048/X.js
deleted file mode 100644
index a2bce5c..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0048/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0048;
-
-enum X { GREEN(0, 1), RED();
-
-X(int i, int j) {}
-X() {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0049/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0049/X.js
deleted file mode 100644
index 00404fa..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0049/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0049;
-
-enum X { GREEN(0, 1), RED;
-
-X(int i, int j) {}
-X() {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0050/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0050/X.js
deleted file mode 100644
index 60d9373..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0050/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0050;
-
-public class X {
-
- public void foo(String[]...i[]) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0051/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0051/X.js
deleted file mode 100644
index b6f7383..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0051/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0051;
-
-public class X {
-
- public void foo(String[] ... i) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0052/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0052/X.js
deleted file mode 100644
index 3738bb1..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0052/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0052;
-
-class X {
- public @interface E {
- String val();
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0053/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0053/X.js
deleted file mode 100644
index cc3e38a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0053/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0053;
-
-/**
- * test
- */
-public @interface X {
- int val() default 1;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0054/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0054/X.js
deleted file mode 100644
index 7090259..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0054/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0054;
-
-/**
- * test
- */
-public enum X {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0055/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0055/X.js
deleted file mode 100644
index 4522afc..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0055/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0055;
-
-/**
- * test
- */
-@interface X {
- int val() default 1;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0056/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0056/X.js
deleted file mode 100644
index d0a9b74..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0056/X.js
+++ /dev/null
@@ -1,15 +0,0 @@
-package test0056;
-
-public enum X {
-
- BLEU(){
- void foo() {}},
- BLANC,
- ROUGE;
-
- int i = 0;
- void foo(int... i) {
- new Object() {}; //
- Zork1 z;
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0057/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0057/X.js
deleted file mode 100644
index d5b2a31..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0057/X.js
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0057;
-
-public enum X {
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0058/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0058/X.js
deleted file mode 100644
index e9410de..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0058/X.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0058;
-
-@Jpf.Controller(
- catches={
- @Jpf.Catch(type=java.lang.Exception.class, method="handleException"),
- @Jpf.Catch(type=PageFlowException.class, method="handlePageFlowException")
- }
- )
- public class X {}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0059/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0059/X.js
deleted file mode 100644
index e9d4158..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0059/X.js
+++ /dev/null
@@ -1,23 +0,0 @@
-package test0059;
-
-public class X {
- public static final String val = "foo";
-
- public static void main(String[] args) {
- for (Test t : Test.values()) {
- System.out.println(t.name());
- }
- }
-}
-enum Test {
- VAL_A;
-
- private static final String VAL_A_LABEL;
-
- static {
- VAL_A_LABEL = X.val;
- }
-}
-
-
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0063/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0063/X.js
deleted file mode 100644
index a1e2de9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0063/X.js
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0063;
-
-import java.util.List;
-
-public class X<T> {
-
- Object foo() {
- return new X<String>();
- }
-
- public void bar(List<? extends X<?>> c) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0064/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0064/X.js
deleted file mode 100644
index 44f1812..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0064/X.js
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0064;
-
-import java.util.List;
-
-public class X<T, U> {
-
- Object foo() {
- return new X<String, Integer>();
- }
-
- public void bar(List<? extends X<?,?>> c) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0065/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0065/X.js
deleted file mode 100644
index 1641384..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0065/X.js
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0065;
-
-import java.util.List;
-
-public class X<T, U extends List<?>> {
-
- Object foo() {
- return new X<String, List<?>>();
- }
-
- public void bar(List<? extends X<?, ?>> c) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0067/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0067/X.js
deleted file mode 100644
index cba6dff..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0067/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0067;
-
-public class X {
- private void foo(Class<? extends Object> class1) {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0068/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0068/X.js
deleted file mode 100644
index 6eedfa9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0068/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0068;
-
-public class X {
- private void foo(Class<? super Object> class1) {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0069/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0069/X.js
deleted file mode 100644
index 89cc259..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0069/X.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0069;
-
-class Outer<A> {
- class Inner<B> {
- }
-}
-
-public class X {
- void foo() {
- test0069.Outer<String>.Inner<Integer> in = new Outer<String>().new Inner<Integer>();
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0070/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0070/X.js
deleted file mode 100644
index 34eee51..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0070/X.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0070;
-
-class Outer<A> {
- class Inner<C> {
- }
-}
-
-public class X {
- void foo() {
- Outer<String>.Inner<Number> in = new Outer<String>().new Inner<Number>();
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0071/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0071/X.js
deleted file mode 100644
index b3074d4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0071/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0071;
-
-public class X {
- <E extends Object> void m(E e) {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0072/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0072/X.js
deleted file mode 100644
index 78e7fbb..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0072/X.js
+++ /dev/null
@@ -1,52 +0,0 @@
-package test0072;
-
-public class X {
-
- static {
- int var1 = 0;
- System.out.println(var1);
- }
-
- {
- int var2 = 0;
- System.out.println(var2);
- }
-
- public int var3;
-
- public void foo() {
- int var4;
- }
-
- public Object bar() {
- return new Object() {
- public void foo2() {
- int var5;
- }
- };
- }
-
- public int bar2() {
- class C {
- int var6;
-
- public void foo3() {
- int var7;
- }
- };
- return new C().var6;
- }
-
- public X() {
- int var8;
- }
-
- public void bar3(int var9) {
- int[] var10 = new int[] {};
- for (int var11 : var10) {
- }
- }
-
- public X(Object var12) {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0073/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0073/X.js
deleted file mode 100644
index a7528e4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0073/X.js
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0073;
-
-import java.util.List;
-
-public class X {
-
- List<String> foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0074/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0074/X.js
deleted file mode 100644
index 6e2215d..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0074/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0074;
-
-public class X {
-
- java.util.List<String> foo() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0076/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0076/X.js
deleted file mode 100644
index df57c16..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0076/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0076;
-import java.util.Map;
-public class X {
- private Map<String, Double>[][] fScoreTable = new Map[10];
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0077/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0077/X.js
deleted file mode 100644
index b44d0c3..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0077/X.js
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0077;
-public class X {
- private java.util.Map<String, Double>[][] fScoreTable = new java.util.Map[10];
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0081/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0081/X.js
deleted file mode 100644
index 3d12195..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0081/X.js
+++ /dev/null
@@ -1,13 +0,0 @@
-package test0081;
-
-class Y<T> {
- <T> Class foo(T t) {
- return t.getClass();
- }
-}
-public class X {
-
- public static void main(String[] args) {
- Class c = new Y().foo(null);
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0082/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0082/X.js
deleted file mode 100644
index 8bc9dfe..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0082/X.js
+++ /dev/null
@@ -1,11 +0,0 @@
-package test0082;
-
-class Gen<X> {
- class Inn {
- }
-
- Gen<String> v1;
- Gen<String>.Inn v2;
- Gen v3;
- Gen.Inn v4;
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0083/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0083/X.js
deleted file mode 100644
index 122af96..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0083/X.js
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0083;
-
-import java.util.List;
-
-public class X<T> {
- List<Integer> list1;
- List<Number> list2;
- List<? extends Number> list3;
- List<T> list4;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0084/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0084/X.js
deleted file mode 100644
index 4ebd760..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0084/X.js
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0084;
-
-public class X {
- Integer a;
- int b;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0085/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0085/X.js
deleted file mode 100644
index 6523b30..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0085/X.js
+++ /dev/null
@@ -1,6 +0,0 @@
-package test0085;
-
-public class X {
- <T> void foo(T t) {}
- <Q> void bar(Q t) {}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0088/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0088/X.js
deleted file mode 100644
index a0f6e9d..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0088/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0088;
-
-public class X {
- public <E> void foo(E param) {
- E local= param;
- foo(local);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0103/A.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0103/A.js
deleted file mode 100644
index cf74ade..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0103/A.js
+++ /dev/null
@@ -1,15 +0,0 @@
-package test0103;
-
-enum A {
- ONE, TWO, THREE;
-
- public static int foo(int i) {
- return i;
- }
- public static int foo() {
- return 0;
- }
- public static int foo(double d) {
- return (int) d;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0103/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0103/X.js
deleted file mode 100644
index 351fff1..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0103/X.js
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0103;
-
-import static test0103.A.ONE;
-import static test0103.A.foo;
-
-public class X {
- Object o = ONE;
-
- int i = foo();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0104/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0104/X.js
deleted file mode 100644
index ac82518..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0104/X.js
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0104;
-
-import static test0104a.A.C;
-
-public class X {
- public static void main(String[] args) {
- System.out.println(C);
- System.out.println(C());
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0104a/A.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0104a/A.js
deleted file mode 100644
index 5c4a692..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0104a/A.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0104a;
-
-public class A {
-
- public static int C = 5;
- public static int C() {
- return C;
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0137/Source.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0137/Source.js
deleted file mode 100644
index 9805428..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0137/Source.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0137;
-
-public class Source {
- public static interface TestInterface<T>{}
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0137/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0137/X.js
deleted file mode 100644
index baf3691..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0137/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0137;
-
-public class X {
- public void main(String[] args) {
- Source.TestInterface<String> c;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0139/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0139/X.js
deleted file mode 100644
index de08cf7..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0139/X.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0139;
-
-public class X {
- public void foo() {
- test0139a.C<String> c= null;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0139a/C.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0139a/C.js
deleted file mode 100644
index f0c0b57..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0139a/C.js
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0139a;
-
-class C<T> {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0140/Annot.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0140/Annot.js
deleted file mode 100644
index 144c3ac..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0140/Annot.js
+++ /dev/null
@@ -1,4 +0,0 @@
-package test0140;
-
-public @interface Annot {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0140/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0140/X.js
deleted file mode 100644
index fe5b217..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0140/X.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0140;
-
-@Annot
-public enum X {
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0147/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0147/X.js
deleted file mode 100644
index 5512411..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0147/X.js
+++ /dev/null
@@ -1,20 +0,0 @@
-package test0147;
-
-import java.lang.Comparable;
-import java.util.Collection;
-import java.util.Iterator;
-
-public class X {
- public static <T extends Object & Comparable<? super T>> T min(
- Collection<? extends T> coll) {
- Iterator<? extends T> i = coll.iterator();
- T candidate = i.next();
-
- while (i.hasNext()) {
- T next = i.next();
- if (next.compareTo(candidate) < 0)
- candidate = next;
- }
- return candidate;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0153/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0153/X.js
deleted file mode 100644
index 2197e5b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0153/X.js
+++ /dev/null
@@ -1,10 +0,0 @@
-package test0153;
-
-public class X {
- int
-\ud800\udc05\ud800\udc04\ud800\udc03\ud800\udc02\ud800\udc01\ud800\udc00;
- void foo() {
- int
-\ud800\udc05\ud800\udc04\ud800\udc03\ud800\udc02\ud800\udc01\ud800\udc00;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0167/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0167/X.js
deleted file mode 100644
index 4c59c87..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0167/X.js
+++ /dev/null
@@ -1,27 +0,0 @@
-package test0167;
-
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.*;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.*;
-import static test0167.Jpf.*;
-
-interface Jpf {
- @Target(value=METHOD)
- @Retention(value=RUNTIME)
- public static @interface ExceptionHandler {}
-
- @Target(value=ANNOTATION_TYPE)
- @Retention(value=RUNTIME)
- public static @interface Forward {}
-}
-
-public class X {
-
- @Jpf.ExceptionHandler()
- protected Forward newExceptionHandler1(Exception ex, String actionName,
- String message, Object form)
- {
- return null;
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0185/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0185/X.js
deleted file mode 100644
index a91b784..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0185/X.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0185;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@SuppressWarnings("unchecked")
-public class X {
- List<String> ls = new ArrayList();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0186/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0186/X.js
deleted file mode 100644
index 5e427f0..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0186/X.js
+++ /dev/null
@@ -1,9 +0,0 @@
-package test0186;
-
-import java.util.ArrayList;
-import java.util.List;
-
-//@SuppressWarnings("unchecked")
-public class X {
- List<String> ls = new ArrayList();
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0191/E.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0191/E.js
deleted file mode 100644
index 9858695..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0191/E.js
+++ /dev/null
@@ -1,62 +0,0 @@
-package test0191;
-
-import java.io.*;
-import java.util.*;
-
-public class E<T, U extends Number> {
- boolean bool= false;
- char c= 0;
- byte b= 0;
- short s= 0;
- int i= 0;
- long l= 0;
- float f= 0;
- double d= 0;
-
- Boolean bool_class= null;
- Character c_class= null;
- Byte b_class= null;
- Short s_class= null;
- Integer i_class= null;
- Long l_class= null;
- Float f_class= null;
- Double d_class= null;
-
- Object object= null;
- Vector vector= null;
- Socket socket= null;
- Cloneable cloneable= null;
- Collection collection= null;
- Serializable serializable= null;
- Object[] objectArr= null;
- int[] int_arr= null;
- long[] long_arr= null;
- Vector[] vector_arr= null;
- Collection[] collection_arr= null;
- Object[][] objectArrArr= null;
- Collection[][] collection_arrarr= null;
- Vector[][] vector_arrarr= null;
-
- Collection<String> collection_string= null;
- Collection<Object> collection_object= null;
- Collection<Number> collection_number= null;
- Collection<Integer> collection_integer= null;
- Collection<? extends Number> collection_upper_number= null;
- Collection<? super Number> collection_lower_number= null;
- Vector<Object> vector_object= null;
- Vector<Number> vector_number= null;
- Vector<Integer> vector_integer= null;
- Vector<? extends Number> vector_upper_number= null;
- Vector<? super Number> vector_lower_number= null;
- Vector<? extends Exception> vector_upper_exception= null;
- Vector<? super Exception> vector_lower_exception= null;
-
- T t= null;
- U u= null;
- Vector<T> vector_t= null;
- Vector<U> vector_u= null;
- Vector<? extends T> vector_upper_t= null;
- Vector<? extends U> vector_upper_u= null;
- Vector<? super T> vector_lower_t= null;
- Vector<? super U> vector_lower_u= null;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0191/X.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0191/X.js
deleted file mode 100644
index d611e04..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0191/X.js
+++ /dev/null
@@ -1,8 +0,0 @@
-package test0191;
-
-public class X<T, U extends Number> extends E<T, U> {
- void foo() {
- java.util.Vector<java.lang.Object> v =
- (java.util.Vector<java.lang.Object>) collection_upper_number;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test.js
deleted file mode 100644
index 1a291f0..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0230;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-@Target({TYPE,METHOD})
-@Retention(RUNTIME)
-public @interface Test {
- String value() default "";
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test2.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test2.js
deleted file mode 100644
index 10e0577..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test2.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0230;
-
-@Test("SUCCESS")
-@Test("FAILED")
-public class Test2 {
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test3.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test3.js
deleted file mode 100644
index 7fc2e4e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0230/Test3.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0230;
-
-public class Test3 extends Test2 {
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test.js
deleted file mode 100644
index fdd00f1..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-package test0231;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-@Target({TYPE,METHOD})
-@Retention(RUNTIME)
-public @interface Test {
- String value() default "";
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test2.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test2.js
deleted file mode 100644
index e9b0276..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test2.js
+++ /dev/null
@@ -1,7 +0,0 @@
-package test0231;
-
-@Test("SUCCESS")
-@Test("FAILED")
-public class Test2 {
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test3.js b/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test3.js
deleted file mode 100644
index 6ffa9bd..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter15/src/test0231/Test3.js
+++ /dev/null
@@ -1,5 +0,0 @@
-package test0231;
-
-public class Test3 extends Test2 {
-
-}
\ No newline at end of file