Skip to content

Commit

Permalink
Do not test pre 8 JLS
Browse files Browse the repository at this point in the history
It's no longer supported by ecj thus testing for lower JLS is useless.
  • Loading branch information
akurtakov committed Jan 23, 2025
1 parent 19e07c1 commit 593c9f6
Showing 1 changed file with 11 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -47,6 +47,7 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.IMethodBinding;
Expand All @@ -68,8 +69,6 @@
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.ui.tests.core.rules.ProjectTestSetup;

import org.eclipse.jdt.internal.ui.util.ASTHelper;

public class AddUnimplementedMethodsTest {
@Rule
public ProjectTestSetup pts= new ProjectTestSetup();
Expand Down Expand Up @@ -296,7 +295,7 @@ public void insertAt() throws Exception {

String str= """
package p;
public abstract class B {
public abstract void foo() {
}
Expand All @@ -306,22 +305,22 @@ public abstract void foo() {

String originalContent= """
package p;
public class A extends B {
int x;
A() {
}
void bar() {
}
{
}
static {
}
class Inner {
}
}""";
Expand Down Expand Up @@ -383,35 +382,8 @@ interface I {
checkMethods(new String[] { "method2" }, methods);
}

/**
* @deprecated tests deprecated API
*/
@Deprecated
@Test
public void jLS3() throws Exception {
doTestOldAstLevel(ASTHelper.JLS3);
}

/**
* @deprecated tests deprecated API
*/
@Deprecated
@Test
public void jLS4() throws Exception {
doTestOldAstLevel(ASTHelper.JLS4);
}

@Test
public void jLS8() throws Exception {
doTestOldAstLevel(ASTHelper.JLS8);
}

/**
* @param astLevel AST.JLS*
* @deprecated tests deprecated API
*/
@Deprecated
public void doTestOldAstLevel(int astLevel) throws Exception {
ICompilationUnit cu= fPackage.getCompilationUnit("Test1.java");
IType testClass= cu.createType(
"""
Expand All @@ -424,7 +396,8 @@ java.util.List<String>[][] getArray() throws RuntimeException {
""", null, true, null);
cu.createImport("java.util.ArrayList", null, null);

RefactoringASTParser parser= new RefactoringASTParser(astLevel);
@SuppressWarnings("deprecation")
RefactoringASTParser parser= new RefactoringASTParser(AST.JLS8);
CompilationUnit unit= parser.parse(cu, true);
AbstractTypeDeclaration declaration= ASTNodes.getParent(NodeFinder.perform(unit, testClass.getNameRange()), AbstractTypeDeclaration.class);
assertNotNull("Could not find type declaration node", declaration);
Expand Down

0 comments on commit 593c9f6

Please sign in to comment.