src/share/classes/com/sun/tools/javac/jvm/ClassReader.java

changeset 2047
5f915a0c9615
parent 2040
2375ce96e80d
child 2099
1b469fd31e35
equal deleted inserted replaced
2046:1fe358ea75ff 2047:5f915a0c9615
1444 } 1444 }
1445 1445
1446 void attachTypeAnnotations(final Symbol sym) { 1446 void attachTypeAnnotations(final Symbol sym) {
1447 int numAttributes = nextChar(); 1447 int numAttributes = nextChar();
1448 if (numAttributes != 0) { 1448 if (numAttributes != 0) {
1449 ListBuffer<TypeAnnotationProxy> proxies = 1449 ListBuffer<TypeAnnotationProxy> proxies = new ListBuffer<>();
1450 ListBuffer.lb();
1451 for (int i = 0; i < numAttributes; i++) 1450 for (int i = 0; i < numAttributes; i++)
1452 proxies.append(readTypeAnnotation()); 1451 proxies.append(readTypeAnnotation());
1453 annotate.normal(new TypeAnnotationCompleter(sym, proxies.toList())); 1452 annotate.normal(new TypeAnnotationCompleter(sym, proxies.toList()));
1454 } 1453 }
1455 } 1454 }
1594 throw new AssertionError("jvm.ClassReader: Unknown target type for position: " + position); 1593 throw new AssertionError("jvm.ClassReader: Unknown target type for position: " + position);
1595 } 1594 }
1596 1595
1597 { // See whether there is location info and read it 1596 { // See whether there is location info and read it
1598 int len = nextByte(); 1597 int len = nextByte();
1599 ListBuffer<Integer> loc = ListBuffer.lb(); 1598 ListBuffer<Integer> loc = new ListBuffer<>();
1600 for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i) 1599 for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i)
1601 loc = loc.append(nextByte()); 1600 loc = loc.append(nextByte());
1602 position.location = TypeAnnotationPosition.getTypePathFromBinary(loc.toList()); 1601 position.location = TypeAnnotationPosition.getTypePathFromBinary(loc.toList());
1603 } 1602 }
1604 1603
1944 super(sym, List.<CompoundAnnotationProxy>nil()); 1943 super(sym, List.<CompoundAnnotationProxy>nil());
1945 this.proxies = proxies; 1944 this.proxies = proxies;
1946 } 1945 }
1947 1946
1948 List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) { 1947 List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
1949 ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb(); 1948 ListBuffer<Attribute.TypeCompound> buf = new ListBuffer<>();
1950 for (TypeAnnotationProxy proxy: proxies) { 1949 for (TypeAnnotationProxy proxy: proxies) {
1951 Attribute.Compound compound = deproxyCompound(proxy.compound); 1950 Attribute.Compound compound = deproxyCompound(proxy.compound);
1952 Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position); 1951 Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
1953 buf.add(typeCompound); 1952 buf.add(typeCompound);
1954 } 1953 }
2031 2030
2032 private List<Type> adjustMethodParams(long flags, List<Type> args) { 2031 private List<Type> adjustMethodParams(long flags, List<Type> args) {
2033 boolean isVarargs = (flags & VARARGS) != 0; 2032 boolean isVarargs = (flags & VARARGS) != 0;
2034 if (isVarargs) { 2033 if (isVarargs) {
2035 Type varargsElem = args.last(); 2034 Type varargsElem = args.last();
2036 ListBuffer<Type> adjustedArgs = ListBuffer.lb(); 2035 ListBuffer<Type> adjustedArgs = new ListBuffer<>();
2037 for (Type t : args) { 2036 for (Type t : args) {
2038 adjustedArgs.append(t != varargsElem ? 2037 adjustedArgs.append(t != varargsElem ?
2039 t : 2038 t :
2040 ((ArrayType)t).makeVarargs()); 2039 ((ArrayType)t).makeVarargs());
2041 } 2040 }

mercurial