-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create bridge methods to private lambda implementation methods, inste…
- Loading branch information
Showing
8 changed files
with
199 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 1 addition & 14 deletions
15
retrolambda/src/main/java/net/orfjackal/retrolambda/Flags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
// Copyright © 2013 Esko Luontola <www.orfjackal.net> | ||
// Copyright © 2013-2014 Esko Luontola <www.orfjackal.net> | ||
// This software is released under the Apache License 2.0. | ||
// The license text is at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package net.orfjackal.retrolambda; | ||
|
||
import static org.objectweb.asm.Opcodes.ACC_PRIVATE; | ||
|
||
public class Flags { | ||
|
||
public static int makeNonPrivate(int access) { | ||
if (hasFlag(access, ACC_PRIVATE)) { | ||
return clearFlag(access, ACC_PRIVATE); // make package-private (i.e. no flag) | ||
} | ||
return access; | ||
} | ||
|
||
public static boolean hasFlag(int subject, int flag) { | ||
return (subject & flag) == flag; | ||
} | ||
|
||
public static int clearFlag(int subject, int flag) { | ||
return subject & ~flag; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
retrolambda/src/main/java/net/orfjackal/retrolambda/Handles.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright © 2013-2014 Esko Luontola <www.orfjackal.net> | ||
// This software is released under the Apache License 2.0. | ||
// The license text is at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package net.orfjackal.retrolambda; | ||
|
||
import org.objectweb.asm.Handle; | ||
|
||
import static org.objectweb.asm.Opcodes.*; | ||
|
||
public class Handles { | ||
|
||
public static int getOpcode(Handle handle) { | ||
int tag = handle.getTag(); | ||
switch (tag) { | ||
case H_INVOKEVIRTUAL: | ||
return INVOKEVIRTUAL; | ||
case H_INVOKESTATIC: | ||
return INVOKESTATIC; | ||
case H_INVOKESPECIAL: | ||
return INVOKESPECIAL; | ||
case H_NEWINVOKESPECIAL: | ||
return INVOKESPECIAL; // we assume that the caller takes care of the NEW instruction | ||
case H_INVOKEINTERFACE: | ||
return INVOKEINTERFACE; | ||
default: | ||
throw new IllegalArgumentException("Unsupported tag " + tag + " in " + handle); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.