forked from JavaTX/JavaCompilerCore
Pfad der erzeugten klassendateien angepasst
This commit is contained in:
parent
a785c85d42
commit
49ea4ee283
@ -187,7 +187,11 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
// Method getModifiers() ?
|
// Method getModifiers() ?
|
||||||
int acc = isInterface?Opcodes.ACC_ABSTRACT:method.modifier;
|
int acc = isInterface?Opcodes.ACC_ABSTRACT:method.modifier;
|
||||||
System.out.println(acc);
|
System.out.println(acc);
|
||||||
|
|
||||||
|
/*Prüfe, ob die Rückgabe-Type der Methode eine Type-Variable ist*/
|
||||||
boolean hasGenInParameterList = genericsAndBounds.containsKey(resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor()));
|
boolean hasGenInParameterList = genericsAndBounds.containsKey(resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor()));
|
||||||
|
/*Wenn die Rückgabe-Type eine Typ-variable ist, erzeuge direkt die Signature, wenn nicht,
|
||||||
|
* prüfe, ob einer der Parameter Typ-Variable als Typ hat*/
|
||||||
if(!hasGenInParameterList) {
|
if(!hasGenInParameterList) {
|
||||||
for(String paramName : methodParamsAndTypes.keySet()) {
|
for(String paramName : methodParamsAndTypes.keySet()) {
|
||||||
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToDescriptor());
|
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToDescriptor());
|
||||||
@ -202,6 +206,8 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
//then create the descriptor with the new syntax.
|
//then create the descriptor with the new syntax.
|
||||||
|
|
||||||
String sig = null;
|
String sig = null;
|
||||||
|
/* method.getGenerics: <....> RT method(..)
|
||||||
|
* */
|
||||||
boolean hasGen = method.getGenerics().iterator().hasNext() || hasGenInParameterList;
|
boolean hasGen = method.getGenerics().iterator().hasNext() || hasGenInParameterList;
|
||||||
|
|
||||||
/* if method has generics or return type is TPH, create signature */
|
/* if method has generics or return type is TPH, create signature */
|
||||||
|
@ -50,9 +50,9 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: generate a class java%% ... %%
|
//TODO: generate a class java%% ... %%
|
||||||
// else if(((RefType) fp.getType()).getParaList().size() > 0){
|
else if(resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor()).contains("<")){
|
||||||
// desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "%").replace("<", "%%").replace(">", "%%")+ ";";
|
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "%").replace("<", "%%").replace(">", "%%")+ ";";
|
||||||
// }
|
}
|
||||||
else {
|
else {
|
||||||
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
|
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public class JavaTXCompiler {
|
|||||||
for(String name : classFiles.keySet()) {
|
for(String name : classFiles.keySet()) {
|
||||||
byte[] bytecode = classFiles.get(name);
|
byte[] bytecode = classFiles.get(name);
|
||||||
System.out.println("generating "+name+ ".class file ...");
|
System.out.println("generating "+name+ ".class file ...");
|
||||||
output = new FileOutputStream(new File(System.getProperty("user.dir") + "/testBytecode/generatedBC/examples/" +name+".class"));
|
output = new FileOutputStream(new File(System.getProperty("user.dir") + "/testBytecode/generatedBC/" +name+".class"));
|
||||||
output.write(bytecode);
|
output.write(bytecode);
|
||||||
output.close();
|
output.close();
|
||||||
System.out.println(name+".class file generated");
|
System.out.println(name+".class file generated");
|
||||||
|
@ -2,7 +2,7 @@ import java.lang.Integer;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
public class Gen{
|
public class Gen{
|
||||||
Vector<Integer> m(Vector<Integer> v){
|
Vector<? extends Integer> m(Vector<Integer> v){
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user