mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8004727: Add compiler support for parameter reflection
Reviewed-by: jjg
This commit is contained in:
parent
e8ce882d43
commit
73b497c12e
12 changed files with 713 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -46,6 +46,7 @@ import com.sun.tools.classfile.InnerClasses_attribute;
|
|||
import com.sun.tools.classfile.LineNumberTable_attribute;
|
||||
import com.sun.tools.classfile.LocalVariableTable_attribute;
|
||||
import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
|
||||
import com.sun.tools.classfile.MethodParameters_attribute;
|
||||
import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
|
||||
import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
|
||||
import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
|
||||
|
@ -386,6 +387,28 @@ public class AttributeWriter extends BasicWriter
|
|||
return null;
|
||||
}
|
||||
|
||||
private static final String format = "%-31s%s";
|
||||
|
||||
public Void visitMethodParameters(MethodParameters_attribute attr,
|
||||
Void ignore) {
|
||||
|
||||
final String header = String.format(format, "Name", "Flags");
|
||||
println("MethodParameters:");
|
||||
indent(+1);
|
||||
println(header);
|
||||
for (MethodParameters_attribute.Entry entry :
|
||||
attr.method_parameter_table) {
|
||||
String flagstr =
|
||||
(0 != (entry.flags & ACC_FINAL) ? " final" : "") +
|
||||
(0 != (entry.flags & ACC_SYNTHETIC) ? " synthetic" : "");
|
||||
println(String.format(format,
|
||||
constantWriter.stringValue(entry.name_index),
|
||||
flagstr));
|
||||
}
|
||||
indent(-1);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
|
||||
println("RuntimeVisibleAnnotations:");
|
||||
indent(+1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue