[10] RFR: 8178384: Reduce work in java.lang.invoke initializers
Claes Redestad
claes.redestad at oracle.com
Tue Apr 11 09:06:42 UTC 2017
On 04/10/2017 05:20 PM, Claes Redestad wrote:
>
> On 04/10/2017 05:19 PM, Vladimir Ivanov wrote:
>> Looks good.
>
> Thanks for reviewing!
>
>>
>> One small suggestion [1]
>
> Sure, updated in-place.
Taking a second look at these constants, it turned out that a few of
them were unused, but since they
weren't private this wasn't called out in my IDE. Mind if I clean this
up (add private modifier, remove
unused JLS_SIG, JLC_SIG, BMHSPECIES_DATA_GFC_SIG, VOID_SIG) as part of
this patch?
I've verified none of the remaining constants are used anywhere outside
the class, i.e., no synthetic
accessor methods are added by this refactoring.
Thanks!
/Claes
diff -r 524eb921da04
src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
---
a/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
Tue Apr 11 10:51:05 2017 +0200
+++
b/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
Tue Apr 11 11:01:22 2017 +0200
@@ -450,33 +450,29 @@
*/
static class Factory {
- static final String JLO_SIG = "Ljava/lang/Object;";
- static final String JLS_SIG = "Ljava/lang/String;";
- static final String JLC_SIG = "Ljava/lang/Class;";
- static final String MH = "java/lang/invoke/MethodHandle";
- static final String MH_SIG = "L"+MH+";";
- static final String BMH =
"java/lang/invoke/BoundMethodHandle";
- static final String BMH_NAME =
"java.lang.invoke.BoundMethodHandle";
- static final String BMH_SIG = "L"+BMH+";";
- static final String SPECIES_DATA =
"java/lang/invoke/BoundMethodHandle$SpeciesData";
- static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
- static final String STABLE_SIG =
"Ljdk/internal/vm/annotation/Stable;";
+ private static final String JLO_SIG = "Ljava/lang/Object;";
+ private static final String MH =
"java/lang/invoke/MethodHandle";
+ private static final String MH_SIG = "L"+MH+";";
+ private static final String BMH =
"java/lang/invoke/BoundMethodHandle";
+ private static final String BMH_NAME =
"java.lang.invoke.BoundMethodHandle";
+ private static final String BMH_SIG = "L"+BMH+";";
+ private static final String SPECIES_DATA =
"java/lang/invoke/BoundMethodHandle$SpeciesData";
+ private static final String SPECIES_DATA_SIG =
"L"+SPECIES_DATA+";";
+ private static final String STABLE_SIG =
"Ljdk/internal/vm/annotation/Stable;";
- static final String SPECIES_PREFIX_NAME = "Species_";
- static final String SPECIES_PREFIX_PATH = BMH + "$" +
SPECIES_PREFIX_NAME;
- static final String SPECIES_CLASS_PREFIX = BMH_NAME + "$" +
SPECIES_PREFIX_NAME;
+ private static final String SPECIES_PREFIX_NAME = "Species_";
+ private static final String SPECIES_PREFIX_PATH = BMH + "$" +
SPECIES_PREFIX_NAME;
+ private static final String SPECIES_CLASS_PREFIX = BMH_NAME +
"$" + SPECIES_PREFIX_NAME;
- static final String BMHSPECIES_DATA_EWI_SIG = "(B)" +
SPECIES_DATA_SIG;
- static final String BMHSPECIES_DATA_GFC_SIG = "(" + JLS_SIG +
JLC_SIG + ")" + SPECIES_DATA_SIG;
- static final String MYSPECIES_DATA_SIG = "()" + SPECIES_DATA_SIG;
- static final String VOID_SIG = "()V";
- static final String INT_SIG = "()I";
+ private static final String BMHSPECIES_DATA_EWI_SIG = "(B)" +
SPECIES_DATA_SIG;
+ private static final String MYSPECIES_DATA_SIG = "()" +
SPECIES_DATA_SIG;
+ private static final String INT_SIG = "()I";
- static final String SIG_INCIPIT =
"(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;";
+ private static final String SIG_INCIPIT =
"(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;";
- static final String[] E_THROWABLE = new String[] {
"java/lang/Throwable" };
+ private static final String[] E_THROWABLE = new String[] {
"java/lang/Throwable" };
- static final ConcurrentMap<String, Class<? extends
BoundMethodHandle>> CLASS_CACHE = new ConcurrentHashMap<>();
+ private static final ConcurrentMap<String, Class<? extends
BoundMethodHandle>> CLASS_CACHE = new ConcurrentHashMap<>();
/**
* Get a concrete subclass of BMH for a given combination of
bound types.
>
> /Claes
More information about the core-libs-dev
mailing list