Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7902913: jasm incorrectly processes the instruction pair: ldc MethodHandle #18

wants to merge 1 commit into from
Changes from all commits
File filter

Filter by extension

Filter by extension

Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -22,6 +22,7 @@
package org.openjdk.asmtools.jasm;

import java.util.Arrays;
import java.util.EnumSet;
import java.util.Optional;

@@ -417,6 +418,16 @@ public static Optional<Token> get(String parsekey, KeywordType ktype) {

* Checks that this enum element is in an enum list
* @param tokens the list of enum elements for checking
* @return true if a tokens list contains this enum element
public boolean in(Token... tokens) {
return (tokens == null) ? false : Arrays.asList(tokens).contains(this);

// By default, if a KeywordType is not specified, it has the value 'TOKEN'
Token(Integer val, String print, String parsekey, EnumSet<TokenType> ttype) {
this(val, print, parsekey, null, ttype, KeywordType.TOKEN);
@@ -433,13 +433,18 @@ ConstCell parseMethodHandle(SubTag subtag) throws Scanner.SyntaxError, IOExcepti
* ldc Dynamic REF_newInvokeSpecial:InterfaceMethod LdcConDyTwice."<init>":
* ldc Dynamic REF_invokeInterface:LdcConDyTwice."<init>":
* ldc Dynamic REF_newInvokeSpecial:Method LdcConDyTwice."<init>":
* ldc MethodHandle REF_newInvokeSpecial:InterfaceMethod LdcConDyTwice."<init>":
* ldc MethodHandle REF_invokeInterface:LdcConDyTwice."<init>":
* ldc MethodHandle REF_newInvokeSpecial:Method LdcConDyTwice."<init>":
* invokedynamic MethodHandle REF_invokeStatic:Method java/lang/invoke/StringConcatFactory.makeConcatWithConstants:
* invokedynamic MethodHandle REF_invokeStatic:java/lang/invoke/StringConcatFactory.makeConcatWithConstants
* ....
* @param position the position in a source file
* @param defaultTag expected reference_index tag (Method or InterfaceMethod)
* @param defaultTag 2nd expected reference_index tag (Method or InterfaceMethod)
private void checkReferenceIndex(int position, ConstType defaultTag, ConstType default2Tag) {
if (scanner.token != COLON) {
if ( !, SEMICOLON) ) {
if (default2Tag != null) {
env.error(position, "wrong.tag2", defaultTag.parseKey(), default2Tag.parseKey());
} else {