forked from JavaTX/JavaCompilerCore
Fehler bei GenericInsertPoints beheben
This commit is contained in:
parent
3b8ef58222
commit
d64823ea30
@ -31,7 +31,7 @@ public class NewClass extends MethodCall
|
|||||||
* @param start
|
* @param start
|
||||||
*/
|
*/
|
||||||
public NewClass(RefType newClass, ArgumentList args, Token start) {
|
public NewClass(RefType newClass, ArgumentList args, Token start) {
|
||||||
super(newClass, new Receiver(new EmptyStmt(start)), "new "+newClass.getName().toString(), args, start);
|
super(newClass, new Receiver(new EmptyStmt(start)), newClass.getName().toString(), args, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -245,7 +245,8 @@ public class OutputGenerator implements ASTVisitor {
|
|||||||
@Override
|
@Override
|
||||||
public void visit(NewClass methodCall) {
|
public void visit(NewClass methodCall) {
|
||||||
out.append("new ");
|
out.append("new ");
|
||||||
visit((MethodCall) methodCall);
|
out.append(methodCall.name);
|
||||||
|
methodCall.getArgumentList().accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -173,8 +173,6 @@ public class TypeOutputGenerator extends OutputGenerator {
|
|||||||
@Override
|
@Override
|
||||||
public void visit(NewClass methodCall) {
|
public void visit(NewClass methodCall) {
|
||||||
super.visit(methodCall);
|
super.visit(methodCall);
|
||||||
this.out.append("::");
|
|
||||||
methodCall.getType().accept(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -128,10 +128,11 @@ public class TypeInsertFactory {
|
|||||||
//Offset zum Einstzen bestimmen:
|
//Offset zum Einstzen bestimmen:
|
||||||
Token offset;
|
Token offset;
|
||||||
String insert = "";
|
String insert = "";
|
||||||
String end =" ";
|
String end;
|
||||||
if(cl.getGenerics().iterator().hasNext()){
|
if(cl.getGenerics().iterator().hasNext()){
|
||||||
offset = cl.getGenerics().iterator().next().getOffset();
|
//offset = cl.getGenerics().iterator().next().getOffset();
|
||||||
insert+=",";
|
offset = cl.getGenerics().getOffset();
|
||||||
|
end=",";
|
||||||
}else{
|
}else{
|
||||||
offset = cl.getGenerics().getOffset();
|
offset = cl.getGenerics().getOffset();
|
||||||
insert += "<";
|
insert += "<";
|
||||||
@ -154,6 +155,7 @@ public class TypeInsertFactory {
|
|||||||
|
|
||||||
//String zum Einsetzen (Generics mit bounds) generieren:
|
//String zum Einsetzen (Generics mit bounds) generieren:
|
||||||
Iterator<TypePlaceholder> it = genericsAndBounds.keySet().iterator();
|
Iterator<TypePlaceholder> it = genericsAndBounds.keySet().iterator();
|
||||||
|
if(! it.hasNext())return new TypeInsertPoint(offset, "");
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
TypePlaceholder tph = it.next();
|
TypePlaceholder tph = it.next();
|
||||||
insert += tph.getName();
|
insert += tph.getName();
|
||||||
|
@ -11,7 +11,7 @@ public class TypeInsertPoint {
|
|||||||
|
|
||||||
public TypeInsertPoint(Token point, String toInsert){
|
public TypeInsertPoint(Token point, String toInsert){
|
||||||
this.point = point;
|
this.point = point;
|
||||||
this.insertString = toInsert + " ";
|
this.insertString = (toInsert.length()>1) ? toInsert + " " : toInsert;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String insert(String intoSource, List<TypeInsertPoint> additionalOffset){
|
public String insert(String intoSource, List<TypeInsertPoint> additionalOffset){
|
||||||
|
@ -30,8 +30,8 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() throws IOException, ClassNotFoundException {
|
public void test() throws IOException, ClassNotFoundException {
|
||||||
filesToTest.add(new File(rootDirectory+"Faculty.jav"));
|
//filesToTest.add(new File(rootDirectory+"Faculty.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
|
filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
|
||||||
//filesToTest.add(new File(rootDirectory+"Lambda3.jav"));
|
//filesToTest.add(new File(rootDirectory+"Lambda3.jav"));
|
||||||
@ -58,13 +58,4 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
|
|||||||
return new String(encoded, encoding);
|
return new String(encoded, encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String showTPHInformation(Iterable<TypePlaceholder> tphs){
|
|
||||||
StringBuilder ret = new StringBuilder();
|
|
||||||
OutputGenerator gen = new OutputGenerator(ret);
|
|
||||||
for(TypePlaceholder tph : tphs){
|
|
||||||
gen.visit(tph);
|
|
||||||
}
|
|
||||||
return ret.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user