Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work in progress #2995

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
Expand Down Expand Up @@ -94,6 +95,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.IOException;
import java.io.Writer;
import java.nio.channels.FileChannel;
import java.util.Arrays;

import org.eclipse.emf.mwe2.runtime.Mandatory;
import org.eclipse.emf.mwe2.runtime.workflow.IWorkflowComponent;
Expand Down Expand Up @@ -44,7 +45,9 @@ public void invoke(IWorkflowContext ctx) {
if (!list.exists())
list.createNewFile();
writer = new BufferedWriter(new FileWriter(list));
for(File javaFile: directory.listFiles()) {
File[] files = directory.listFiles();
Arrays.sort(files);
for(File javaFile: files) {
if (javaFile.isFile() && javaFile.getName().endsWith(".java")) {
File target = new File(javaFile.getAbsolutePath() + ".txt");
writer.write(directory.toURI().relativize(target.toURI()).getPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
module org.eclipse.xtext.common.types.util.CopyTestData

var eclipsePath
var xbasePath
var commonPath
var javaPath
var binPath = "${eclipsePath}/bin"
var xbasePath = "${eclipsePath}/../org.eclipse.xtext.xbase.testdata"
var commonPath = "${eclipsePath}/../org.eclipse.xtext.common.types"
var binPath = "${eclipsePath}/target/classes"
var packagePath = "org/eclipse/xtext/common/types/testSetups"
var srcPath = "${eclipsePath}/testdata/${packagePath}"

Expand All @@ -36,10 +35,6 @@ Workflow {
sourcePath = "${eclipsePath}/tests/${typeProvider}"
targetPath = "${commonPath}/tests/${typeProvider}"
}
component = CopyDirectory {
sourcePath = "${eclipsePath}/tests/${typeProvider}"
targetPath = "${javaPath}/src/${typeProvider}"
}
component = CopyDirectory {
sourcePath = "${eclipsePath}/testdata/org/eclipse/xtext/common/types/testSetups"
targetPath = "${xbasePath}/src/org/eclipse/xtext/common/types/testSetups"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
SuperClass.java.txt
Bug456328.java.txt
GenericSuperClass.java.txt
SimpleAnnotation.java.txt
Bug347739ThreeTypeParamsSuperSuper.java.txt
EmptyAbstractClass.java.txt
Bug438740.java.txt
TestEnum.java.txt
Bug428340.java.txt
TestConstants.java.txt
InitializerWithConstructor.java.txt
TypeWithInnerAnnotation.java.txt
DeprecatedMembers.java.txt
StaticNestedTypes.java.txt
TestAnnotationWithStringDefault.java.txt
$StartsWithDollar.java.txt
AbstractMethods.java.txt
AnnotatedClassWithStringDefault.java.txt
AnnotatedInterfaceWithStringDefault.java.txt
Bug334943Client.java.txt
Bug347739.java.txt
NestedInterfaces.java.txt
Methods.java.txt
Bug347739OneTypeParam.java.txt
Bug347739ThreeTypeParams.java.txt
Bug347739ThreeTypeParamsSuper.java.txt
Bug347739ThreeTypeParamsSuperSuper.java.txt
Bug427098.java.txt
TestAnnotationWithDefaults.java.txt
Bug428340.java.txt
Bug438740.java.txt
Bug456328.java.txt
Bug470767.java.txt
CallableThrowsExceptions.java.txt
ClassContainingEnum.java.txt
ClassWithVarArgs.java.txt
Concrete.java.txt
DeprecatedClass.java.txt
DeprecatedMembers.java.txt
EmptyAbstractClass.java.txt
Fields.java.txt
ParameterizedTypes.java.txt
GenericSuperClass.java.txt
InitializerWithConstructor.java.txt
InitializerWithoutConstructor.java.txt
Methods.java.txt
NestedInterfaces.java.txt
NestedParameterizedTypes.java.txt
NestedTypeInheritance.java.txt
TypeParamEndsWithDollar.java.txt
Concrete.java.txt
SubClass.java.txt
RawIterable.java.txt
Bug334943Client.java.txt
NestedTypes.java.txt
ParameterizedMethods.java.txt
ParameterizedTypes.java.txt
ParameterizedTypes2.java.txt
RawIterable.java.txt
SimpleAnnotation.java.txt
StaticNestedTypes.java.txt
SubClass.java.txt
SubOfGenericClass.java.txt
SuperClass.java.txt
TestAnnotation.java.txt
Bug347739OneTypeParam.java.txt
Bug470767.java.txt
TestAnnotationWithDefaults.java.txt
TestAnnotationWithStringDefault.java.txt
TestConstants.java.txt
TestEnum.java.txt
TestScenario.java.txt
DeprecatedClass.java.txt
AnnotatedClassWithStringDefault.java.txt
NestedParameterizedTypes.java.txt
CallableThrowsExceptions.java.txt
$StartsWithDollar.java.txt
TypeParamEndsWithDollar.java.txt
TypeWithInnerAnnotation.java.txt
TypeWithInnerEnum.java.txt
ParameterizedMethods.java.txt
InitializerWithoutConstructor.java.txt
ClassContainingEnum.java.txt
SubOfGenericClass.java.txt
AnnotatedInterfaceWithStringDefault.java.txt
Bug347739ThreeTypeParamsSuper.java.txt
NestedTypes.java.txt
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
import org.eclipse.xtext.common.types.access.IMirror;
import org.eclipse.xtext.common.types.access.TypeResource;
import org.eclipse.xtext.common.types.access.binary.BinaryClassMirror;
import org.eclipse.xtext.common.types.testSetups.AbstractMethods;
import org.eclipse.xtext.common.types.testSetups.Bug347739ThreeTypeParamsSuperSuper;
import org.eclipse.xtext.common.types.testSetups.ClassWithVarArgs;
import org.eclipse.xtext.common.types.xtext.ui.tests.RefactoringTestLanguageInjectorProvider;
import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
Expand Down Expand Up @@ -279,22 +276,6 @@ protected String getCollectionParamName() {
return "arg0";
}

@Override
@Test
public void testParameterNames_01() {
doTestParameterName(Bug347739ThreeTypeParamsSuperSuper.class, "getToken(A)", "arg0");
}
@Override
@Test
public void testParameterNames_02() {
doTestParameterName(AbstractMethods.class, "abstractMethodWithParameter(java.lang.String)", "arg0");
}
@Override
@Test
public void testParameterNames_03() {
doTestParameterName(ClassWithVarArgs.class, "method(java.lang.String[])", "arg0");
}

@Test
public void testJvmTypeSimple_Issue145() {
Resource resource = resourceSet.createResource(URI.createURI("foo.typesRefactoring"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public JvmDeclaredType buildType() {
}
ClassReader reader = new ClassReader(bytes);
reader.accept(this,
ClassReader.SKIP_DEBUG
| ClassReader.SKIP_FRAMES
ClassReader.SKIP_FRAMES
| ClassReader.SKIP_CODE
);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*******************************************************************************/
package org.eclipse.xtext.common.types.access.binary.asm;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -40,6 +41,8 @@ public class JvmExecutableBuilder extends MethodVisitor implements Opcodes {

private final JvmExecutable result;

private List<String> parameterNames;

private final int offset;

private String returnType;
Expand Down Expand Up @@ -156,6 +159,12 @@ public AnnotationVisitor visitAnnotation(final String desc, final boolean visibl

@Override
public void visitEnd() {
if (parameterNames != null) {
InternalEList<JvmFormalParameter> parameters = (InternalEList<JvmFormalParameter>) result.getParameters();
for(int i = 0, max = parameters.size(), nameOffset = parameterNames.size() - max; i < max; i++) {
parameters.get(i).setName(parameterNames.get(i + nameOffset));
}
}
InternalEList<JvmMember> members = (InternalEList<JvmMember>) declarator.getMembers();
members.addUnique(result);
}
Expand Down Expand Up @@ -237,9 +246,18 @@ public AnnotationVisitor visitArray(String name) {
@Override
public AnnotationVisitor visitParameterAnnotation(final int parameter, final String desc, final boolean visible) {
JvmFormalParameter formalParameter = result.getParameters().get(parameter);
return new JvmAnnotationReferenceBuilder(
(InternalEList<JvmAnnotationReference>) formalParameter.getAnnotations(), desc, proxies);
return new JvmAnnotationReferenceBuilder(
(InternalEList<JvmAnnotationReference>) formalParameter.getAnnotations(), desc, proxies);
}

@Override
public void visitParameter(String name, int access) {
if (parameterNames == null) {
parameterNames = new ArrayList<String>(result.getParameters().size());
}
parameterNames.add(name);

}

@Override
public void visitCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
import org.eclipse.xtext.common.types.JvmOperation;
import org.eclipse.xtext.common.types.access.IJvmTypeProvider;
import org.eclipse.xtext.common.types.access.impl.AbstractTypeProviderTest;
import org.eclipse.xtext.common.types.testSetups.AbstractMethods;
import org.eclipse.xtext.common.types.testSetups.Bug347739ThreeTypeParamsSuperSuper;
import org.eclipse.xtext.common.types.testSetups.ClassWithVarArgs;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions;
Expand Down Expand Up @@ -134,24 +131,6 @@ public void testFindTypeByName_AbstractMultimap_02() {
assertEquals("java:/Objects/javax.annotation.CheckForNull", EcoreUtil.getURI(annotationType).trimFragment().toString());
}

@Test
@Override
public void testParameterNames_01() {
doTestParameterName(Bug347739ThreeTypeParamsSuperSuper.class, "getToken(A)", "arg0");
}

@Test
@Override
public void testParameterNames_02() {
doTestParameterName(AbstractMethods.class, "abstractMethodWithParameter(java.lang.String)", "arg0");
}

@Test
@Override
public void testParameterNames_03() {
doTestParameterName(ClassWithVarArgs.class, "method(java.lang.String[])", "arg0");
}

@Ignore
@Test
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
Expand Down
Loading