Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for Java 8 constants
Created from patch provided by @iloveeclipse, but only with significant
changes.
  • Loading branch information
Juan Carlos Estibariz authored and Juan Carlos Estibariz committed Sep 2, 2015
1 parent 6e0d306 commit bb55f7c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/jdepend/framework/ClassFileParser.java
Expand Up @@ -27,6 +27,10 @@ public class ClassFileParser extends AbstractParser {
public static final int CONSTANT_METHOD = 10; public static final int CONSTANT_METHOD = 10;
public static final int CONSTANT_INTERFACEMETHOD = 11; public static final int CONSTANT_INTERFACEMETHOD = 11;
public static final int CONSTANT_NAMEANDTYPE = 12; public static final int CONSTANT_NAMEANDTYPE = 12;
public static final int CONSTANT_METHOD_HANDLE = 15;
public static final int CONSTANT_METHOD_TYPE = 16;
public static final int CONSTANT_INVOKEDYNAMIC = 18;

public static final char CLASS_DESCRIPTOR = 'L'; public static final char CLASS_DESCRIPTOR = 'L';
public static final int ACC_INTERFACE = 0x200; public static final int ACC_INTERFACE = 0x200;
public static final int ACC_ABSTRACT = 0x400; public static final int ACC_ABSTRACT = 0x400;
Expand Down Expand Up @@ -267,12 +271,14 @@ private Constant parseNextConstant() throws IOException {


case (ClassFileParser.CONSTANT_CLASS): case (ClassFileParser.CONSTANT_CLASS):
case (ClassFileParser.CONSTANT_STRING): case (ClassFileParser.CONSTANT_STRING):
case (ClassFileParser.CONSTANT_METHOD_TYPE):
result = new Constant(tag, in.readUnsignedShort()); result = new Constant(tag, in.readUnsignedShort());
break; break;
case (ClassFileParser.CONSTANT_FIELD): case (ClassFileParser.CONSTANT_FIELD):
case (ClassFileParser.CONSTANT_METHOD): case (ClassFileParser.CONSTANT_METHOD):
case (ClassFileParser.CONSTANT_INTERFACEMETHOD): case (ClassFileParser.CONSTANT_INTERFACEMETHOD):
case (ClassFileParser.CONSTANT_NAMEANDTYPE): case (ClassFileParser.CONSTANT_NAMEANDTYPE):
case (ClassFileParser.CONSTANT_INVOKEDYNAMIC):
result = new Constant(tag, in.readUnsignedShort(), in result = new Constant(tag, in.readUnsignedShort(), in
.readUnsignedShort()); .readUnsignedShort());
break; break;
Expand All @@ -291,6 +297,9 @@ private Constant parseNextConstant() throws IOException {
case (ClassFileParser.CONSTANT_UTF8): case (ClassFileParser.CONSTANT_UTF8):
result = new Constant(tag, in.readUTF()); result = new Constant(tag, in.readUTF());
break; break;
case (ClassFileParser.CONSTANT_METHOD_HANDLE):
result = new Constant(tag, in.readByte(), in.readUnsignedShort());
break;
default: default:
throw new IOException("Unknown constant: " + tag); throw new IOException("Unknown constant: " + tag);
} }
Expand Down

0 comments on commit bb55f7c

Please sign in to comment.