Wildcards werden in der abstrakten Syntax nicht übernommen #229

Open
opened 2018-07-05 12:23:16 +00:00 by pl · 0 comments
Owner

branch bytecode2
commit bd0bfed2cb

import java.util.Vector;
import java.lang.Integer;
import java.lang.Boolean;

Das ungetypte Beispiel

public class Matrix extends Vector<Vector> {
mul(m) {
var ret = new Matrix();
var i = 0;
while(i < size()) {
var v1 = this.elementAt(i);
var v2 = new Vector();
var j = 0;
while(j < v1.size()) {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k)
* m.elementAt(k).elementAt(j);
k++; }
v2.addElement(erg);
j++; }
ret.addElement(v2);
i++;
}
return ret;
}
}

erzeugt folgende Signatur

javap -s Matrix.class
Compiled from "Matrix.jav"
public class Matrix extends java.util.Vector {
public Matrix();
descriptor: ()V

public Matrix mul(java.util.Vector<? extends java.util.Vector<? extends java.lang.Integer>>);
descriptor: (Ljava/util/Vector;)LMatrix;
}

import java.util.Vector;
import java.lang.Integer;
import java.lang.Boolean;

public class Matrix extends Vector<Vector> {
Matrix mul(java.util.Vector<? extends java.util.Vector<? extends java.lang.Integer>> m) {
var ret = new Matrix();
var i = 0;
while(i < size()) {
var v1 = this.elementAt(i);
var v2 = new Vector();
var j = 0;
while(j < v1.size()) {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k)
* m.elementAt(k).elementAt(j);
k++; }
v2.addElement(erg);
j++; }
ret.addElement(v2);
i++;
}
return ret;
}
}

erzeugt aber

javap -s Matrix.class
Compiled from "Matrix.jav"
public class Matrix extends java.util.Vector {
public Matrix();
descriptor: ()V

public Matrix mul(java.util.Vector);
descriptor: (Ljava/util/Vector;)LMatrix;
}

Die Ausgabe des Parsers ergit:

class Matrix {

Matrix mul(java.util.Vector m)({

branch bytecode2 commit bd0bfed2cbf0740d5b94f8ac285137a4c0b75162 import java.util.Vector; import java.lang.Integer; import java.lang.Boolean; Das ungetypte Beispiel public class Matrix extends Vector<Vector<Integer>> { mul(m) { var ret = new Matrix(); var i = 0; while(i < size()) { var v1 = this.elementAt(i); var v2 = new Vector<Integer>(); var j = 0; while(j < v1.size()) { var erg = 0; var k = 0; while(k < v1.size()) { erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); k++; } v2.addElement(erg); j++; } ret.addElement(v2); i++; } return ret; } } erzeugt folgende Signatur javap -s Matrix.class Compiled from "Matrix.jav" public class Matrix extends java.util.Vector { public Matrix(); descriptor: ()V public Matrix mul(java.util.Vector<? extends java.util.Vector<? extends java.lang.Integer>>); descriptor: (Ljava/util/Vector;)LMatrix; } import java.util.Vector; import java.lang.Integer; import java.lang.Boolean; public class Matrix extends Vector<Vector<Integer>> { Matrix mul(java.util.Vector<? extends java.util.Vector<? extends java.lang.Integer>> m) { var ret = new Matrix(); var i = 0; while(i < size()) { var v1 = this.elementAt(i); var v2 = new Vector<Integer>(); var j = 0; while(j < v1.size()) { var erg = 0; var k = 0; while(k < v1.size()) { erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); k++; } v2.addElement(erg); j++; } ret.addElement(v2); i++; } return ret; } } erzeugt aber javap -s Matrix.class Compiled from "Matrix.jav" public class Matrix extends java.util.Vector { public Matrix(); descriptor: ()V public Matrix mul(java.util.Vector); descriptor: (Ljava/util/Vector;)LMatrix; } Die Ausgabe des Parsers ergit: class Matrix { Matrix mul(java.util.Vector<TPH A> m)({
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#229
No description provided.