Vererbung innerhalb mehrerer Klassen in einem File #60

Open
opened 2020-01-21 14:14:53 +00:00 by pl · 0 comments
Owner

Brnach: addPackages
commit: bf80361c1f

In OLOneFile.jav

import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
import java.lang.Boolean;

public class OLOneFile {

 m2(x) { return x + x; }

}

public class OLextendsOneFile extends OLOneFile { }

public class OLMainOneFile {

main(x) { 
	var ol;
	ol = new OLextendsOneFile(); 
	return ol.m2(x); 
}  

}

müsste in getDesc vermutlich die Vererbung berücksichtigt werden.

public String getDesc(String className) throws NotInCurrentPackageException, NotFoundException {
String name = methCall.name;
ClassOrInterface clazz = getClassFromCurrPkg(className);
String retType = getResolvedType(methCall.getType());
ArrayList params = getTypes(methCall.arglist.getArguments());

	Map<String, String> genAndBoundsClass = getGenericsAndBounds(clazz.getGenerics());
	modifyGenAndBounds(genAndBoundsClass);
	for (Method m : clazz.getMethods()) {
		if (name.equals(m.getName()) && retType.equals(getResolvedType(m.getReturnType()))) {
			ArrayList<String> paramsOfM = getTypes(m.getParameterList());
			if(areEquals(params,paramsOfM)) {
				Map<String, String> genAndBoundsMethod = getGenericsAndBoundsMethod(m.getGenerics());
				modifyGenAndBounds(genAndBoundsMethod);
				boolean hasGen = hasGen(m, genAndBoundsClass);
				NormalMethod nm = new NormalMethod(m, (HashMap<String, String>) genAndBoundsClass,
						(HashMap<String, String>) genAndBoundsMethod, hasGen);
				return nm.accept(new DescriptorToString(resultSet));
			}
		}
	}

	throw new NotFoundException("Method " + name + " is not found");
}
Brnach: addPackages commit: bf80361c1f1fe37ecbb284341e19ac3bfff1f00e In OLOneFile.jav import java.lang.String; import java.lang.Integer; import java.lang.Double; import java.lang.Boolean; public class OLOneFile { m2(x) { return x + x; } } public class OLextendsOneFile extends OLOneFile { } public class OLMainOneFile { main(x) { var ol; ol = new OLextendsOneFile(); return ol.m2(x); } } müsste in getDesc vermutlich die Vererbung berücksichtigt werden. public String getDesc(String className) throws NotInCurrentPackageException, NotFoundException { String name = methCall.name; ClassOrInterface clazz = getClassFromCurrPkg(className); String retType = getResolvedType(methCall.getType()); ArrayList<String> params = getTypes(methCall.arglist.getArguments()); Map<String, String> genAndBoundsClass = getGenericsAndBounds(clazz.getGenerics()); modifyGenAndBounds(genAndBoundsClass); for (Method m : clazz.getMethods()) { if (name.equals(m.getName()) && retType.equals(getResolvedType(m.getReturnType()))) { ArrayList<String> paramsOfM = getTypes(m.getParameterList()); if(areEquals(params,paramsOfM)) { Map<String, String> genAndBoundsMethod = getGenericsAndBoundsMethod(m.getGenerics()); modifyGenAndBounds(genAndBoundsMethod); boolean hasGen = hasGen(m, genAndBoundsClass); NormalMethod nm = new NormalMethod(m, (HashMap<String, String>) genAndBoundsClass, (HashMap<String, String>) genAndBoundsMethod, hasGen); return nm.accept(new DescriptorToString(resultSet)); } } } throw new NotFoundException("Method " + name + " is not found"); }
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: JavaTX/JavaCompilerCore#60
No description provided.