Commit b157bf68 authored by Eric Bruneton's avatar Eric Bruneton

Improve the quality of the code related to nest mates.

parent ac801b75
Pipeline #1446 passed with stage
in 3 minutes and 54 seconds
......@@ -155,12 +155,12 @@ public class ClassRemapper extends ClassVisitor {
}
@Override
public void visitNestHost(String nestHost) {
public void visitNestHost(final String nestHost) {
super.visitNestHost(remapper.mapType(nestHost));
}
@Override
public void visitNestMember(String nestMember) {
public void visitNestMember(final String nestMember) {
super.visitNestMember(remapper.mapType(nestMember));
}
......
......@@ -43,7 +43,7 @@ public class RemappingAnnotationAdapter extends AnnotationVisitor {
protected final Remapper remapper;
public RemappingAnnotationAdapter(final AnnotationVisitor av, final Remapper remapper) {
this(Opcodes.ASM7, av, remapper);
this(Opcodes.ASM6, av, remapper);
}
protected RemappingAnnotationAdapter(
......
......@@ -50,7 +50,7 @@ public class RemappingClassAdapter extends ClassVisitor {
protected String className;
public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) {
this(Opcodes.ASM7, cv, remapper);
this(Opcodes.ASM6, cv, remapper);
}
protected RemappingClassAdapter(final int api, final ClassVisitor cv, final Remapper remapper) {
......@@ -140,16 +140,6 @@ public class RemappingClassAdapter extends ClassVisitor {
desc == null ? null : remapper.mapMethodDesc(desc));
}
@Override
public void visitNestHost(String nestHost) {
throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
}
@Override
public void visitNestMember(String nestMember) {
throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
}
protected FieldVisitor createRemappingFieldAdapter(FieldVisitor fv) {
return new RemappingFieldAdapter(fv, remapper);
}
......
......@@ -45,7 +45,7 @@ public class RemappingFieldAdapter extends FieldVisitor {
private final Remapper remapper;
public RemappingFieldAdapter(final FieldVisitor fv, final Remapper remapper) {
this(Opcodes.ASM7, fv, remapper);
this(Opcodes.ASM6, fv, remapper);
}
protected RemappingFieldAdapter(final int api, final FieldVisitor fv, final Remapper remapper) {
......
......@@ -48,7 +48,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter {
public RemappingMethodAdapter(
final int access, final String desc, final MethodVisitor mv, final Remapper remapper) {
this(Opcodes.ASM7, access, desc, mv, remapper);
this(Opcodes.ASM6, access, desc, mv, remapper);
}
protected RemappingMethodAdapter(
......
......@@ -47,7 +47,7 @@ public class RemappingSignatureAdapter extends SignatureVisitor {
private String className;
public RemappingSignatureAdapter(final SignatureVisitor v, final Remapper remapper) {
this(Opcodes.ASM7, v, remapper);
this(Opcodes.ASM6, v, remapper);
}
protected RemappingSignatureAdapter(
......
......@@ -121,10 +121,10 @@ public class ClassNode extends ClassVisitor {
/** The inner classes of this class. */
public List<InnerClassNode> innerClasses;
/** The internal name of the nest host class of this class. */
/** The internal name of the nest host class of this class. May be <tt>null</tt>. */
public String nestHostClass;
/** The internal names of the nest members of this class. */
/** The internal names of the nest members of this class. May be <tt>null</tt>. */
public List<String> nestMembers;
/** The fields of this class. */
......
......@@ -316,7 +316,7 @@ public class CheckClassAdapter extends ClassVisitor {
* Constructs a new {@link CheckClassAdapter}.
*
* @param api the ASM API version implemented by this visitor. Must be one of {@link
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
* Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or {@link Opcodes#ASM7}.
* @param classVisitor the class visitor to which this adapter must delegate calls.
* @param checkDataFlow <tt>true</tt> to perform basic data flow checks, or <tt>false</tt> to not
* perform any data flow check (see {@link CheckMethodAdapter}). This option requires valid
......@@ -439,7 +439,7 @@ public class CheckClassAdapter extends ClassVisitor {
CheckMethodAdapter.checkInternalName(nestMember, "nestMember");
if (visitNestHostCalled) {
throw new IllegalStateException(
"visitMemberOfNest and and visitNestHost are mutually exclusive.");
"visitMemberOfNest and visitNestHost are mutually exclusive.");
}
String packageName = packageName(nestMember);
if (nestMemberPackageName == null) {
......
......@@ -236,7 +236,7 @@ public class Textifier extends Printer {
}
@Override
public void visitNestHost(String nestHost) {
public void visitNestHost(final String nestHost) {
stringBuilder.setLength(0);
stringBuilder.append(tab).append("NESTHOST ");
appendDescriptor(INTERNAL_NAME, nestHost);
......
......@@ -136,11 +136,12 @@ public abstract class ClassVisitor {
}
/**
* Visits the nest host class of the current class. A nest is a set of classes of the same package
* that share access to their private members. The host class should list the current class as
* {@link #visitNestMember(String) nest member}. This method must be called only once and only if
* the current class is a member of a nest. A class is implicitly its own nest, so it's invalid to
* call this method with the current class as argument.
* Visits the nest host class of the class. A nest is a set of classes of the same package that
* share access to their private members. One of these classes, called the host, lists the other
* members of the nest, which in turn should link to the host of their nest. This method must be
* called only once and only if the visited class is a non-host member of a nest. A class is
* implicitly its own nest, so it's invalid to call this method with the visited class name as
* argument.
*
* @param nestHost the internal name of the host class of the nest.
*/
......@@ -223,8 +224,10 @@ public abstract class ClassVisitor {
/**
* Visits a member of the nest. A nest is a set of classes of the same package that share access
* to their private members. The nest member should declare the current class as its {@link
* #visitNestMember(String) host class}.
* to their private members. One of these classes, called the host, lists the other members of the
* nest, which in turn should link to the host of their nest. This method must be called only if
* the visited class is the host of a nest. A nest host is implicitly a member of its own nest, so
* it's invalid to call this method with the visited class name as argument.
*
* @param nestMember the internal name of a nest member.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment