I am getting the following error in the PartialEvaluator code
Unexpected error while evaluating instruction:
Class = [com/acme/pgbu/rest/resources/social/FeedQueryStrategy]
Method = [fromString$6e1f8dce(Ljava/lang/String;)I]
Instruction = [10] ireturn
Exception = [java.lang.IllegalArgumentException] (Value "com/acme/pgbu/rest/resources/social/FeedQueryStrategy" is not an integer value [proguard.evaluation.value.TypedReferenceValue])
This FeedQueryStrategy is an enum, who's fromString method does NOT return an int, it's returning the enum itself so i'm not sure why it thinks it needs to parse an IRETURN.
Here is the javap of this class
Classfile /home/dave/dev/pgbu_platform-2.0/projects/rest/classes/com/acme/pgbu/rest/resources/social/FeedQueryStrategy.class
Last modified Jan 27, 2015; size 1389 bytes
MD5 checksum 8d8a22c513ccf728e232f435955dd9c3
Compiled from "FeedQueryStrategy.java"
public final class com.acme.pgbu.rest.resources.social.FeedQueryStrategy extends java.lang.Enum<com.acme.pgbu.rest.resources.social.feedquerystrategy>
Signature: #38 // Ljava/lang/Enum<lcom acme="" pgbu="" rest="" resources="" social="" feedquerystrategy;="">;
SourceFile: "FeedQueryStrategy.java"
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_ENUM
Constant pool:
#1 = Fieldref #4.#41 // com/acme/pgbu/rest/resources/social/FeedQueryStrategy.$VALUES:[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#2 = Methodref #42.#43 // "[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;".clone:()Ljava/lang/Object;
#3 = Class #21 // "[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;"
#4 = Class #44 // com/acme/pgbu/rest/resources/social/FeedQueryStrategy
#5 = Methodref #13.#45 // java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
#6 = Methodref #13.#46 // java/lang/Enum."<init>":(Ljava/lang/String;I)V
#7 = Methodref #47.#48 // com/acme/pgbu/common/utils/FlexibleEnumDeserializer.deserialize:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
#8 = String #14 // OLDER
#9 = Methodref #4.#49 // com/acme/pgbu/rest/resources/social/FeedQueryStrategy."<init>":(Ljava/lang/String;I)V
#10 = Fieldref #4.#50 // com/acme/pgbu/rest/resources/social/FeedQueryStrategy.OLDER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#11 = String #16 // NEWER
#12 = Fieldref #4.#51 // com/acme/pgbu/rest/resources/social/FeedQueryStrategy.NEWER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#13 = Class #52 // java/lang/Enum
#14 = Utf8 OLDER
#15 = Utf8 Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#16 = Utf8 NEWER
#17 = Utf8 DEFAULT_QUERY_STRATEGY
#18 = Utf8 Ljava/lang/String;
#19 = Utf8 ConstantValue
#20 = Utf8 $VALUES
#21 = Utf8 [Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#22 = Utf8 values
#23 = Utf8 ()[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#24 = Utf8 Code
#25 = Utf8 LineNumberTable
#26 = Utf8 valueOf
#27 = Utf8 (Ljava/lang/String;)Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#28 = Utf8 LocalVariableTable
#29 = Utf8 name
#30 = Utf8 <init>
#31 = Utf8 (Ljava/lang/String;I)V
#32 = Utf8 this
#33 = Utf8 Signature
#34 = Utf8 ()V
#35 = Utf8 fromString
#36 = Utf8 value
#37 = Utf8 <clinit>
#38 = Utf8 Ljava/lang/Enum<lcom acme="" pgbu="" rest="" resources="" social="" feedquerystrategy;="">;
#39 = Utf8 SourceFile
#40 = Utf8 FeedQueryStrategy.java
#41 = NameAndType #20:#21 // $VALUES:[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#42 = Class #21 // "[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;"
#43 = NameAndType #53:#54 // clone:()Ljava/lang/Object;
#44 = Utf8 com/acme/pgbu/rest/resources/social/FeedQueryStrategy
#45 = NameAndType #26:#55 // valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
#46 = NameAndType #30:#31 // "<init>":(Ljava/lang/String;I)V
#47 = Class #56 // com/acme/pgbu/common/utils/FlexibleEnumDeserializer
#48 = NameAndType #57:#55 // deserialize:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
#49 = NameAndType #30:#31 // "<init>":(Ljava/lang/String;I)V
#50 = NameAndType #14:#15 // OLDER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#51 = NameAndType #16:#15 // NEWER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
#52 = Utf8 java/lang/Enum
#53 = Utf8 clone
#54 = Utf8 ()Ljava/lang/Object;
#55 = Utf8 (Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
#56 = Utf8 com/acme/pgbu/common/utils/FlexibleEnumDeserializer
#57 = Utf8 deserialize
{
public static final com.acme.pgbu.rest.resources.social.FeedQueryStrategy OLDER;
flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM</init></init></lcom></clinit></init></init></init></lcom></com.acme.pgbu.rest.resources.social.feedquerystrategy>
public static final com.acme.pgbu.rest.resources.social.FeedQueryStrategy NEWER;
flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ENUM
public static final java.lang.String DEFAULT_QUERY_STRATEGY;
flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL
ConstantValue: String OLDER
public static com.acme.pgbu.rest.resources.social.FeedQueryStrategy[] values();
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: getstatic #1 // Field $VALUES:[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
3: invokevirtual #2 // Method "[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;".clone:()Ljava/lang/Object;
6: checkcast #3 // class "[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;"
9: areturn
LineNumberTable:
line 5: 0
public static com.acme.pgbu.rest.resources.social.FeedQueryStrategy valueOf(java.lang.String);
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=1, args_size=1
0: ldc_w #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
3: aload_0
4: invokestatic #5 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
7: checkcast #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
10: areturn
LineNumberTable:
line 5: 0
LocalVariableTable:
Start Length Slot Name Signature
0 11 0 name Ljava/lang/String;
public static com.acme.pgbu.rest.resources.social.FeedQueryStrategy fromString(java.lang.String);
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=2, locals=1, args_size=1
0: ldc_w #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
3: aload_0
4: invokestatic #7 // Method com/acme/pgbu/common/utils/FlexibleEnumDeserializer.deserialize:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
7: checkcast #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
10: areturn
LineNumberTable:
line 15: 0
LocalVariableTable:
Start Length Slot Name Signature
0 11 0 value Ljava/lang/String;
static {};
flags: ACC_STATIC
Code:
stack=4, locals=0, args_size=0
0: new #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
3: dup
4: ldc #8 // String OLDER
6: iconst_0
7: invokespecial #9 // Method "<init>":(Ljava/lang/String;I)V
10: putstatic #10 // Field OLDER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
13: new #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
16: dup
17: ldc #11 // String NEWER
19: iconst_1
20: invokespecial #9 // Method "<init>":(Ljava/lang/String;I)V
23: putstatic #12 // Field NEWER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
26: iconst_2
27: anewarray #4 // class com/acme/pgbu/rest/resources/social/FeedQueryStrategy
30: dup
31: iconst_0
32: getstatic #10 // Field OLDER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
35: aastore
36: dup
37: iconst_1
38: getstatic #12 // Field NEWER:Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
41: aastore
42: putstatic #1 // Field $VALUES:[Lcom/acme/pgbu/rest/resources/social/FeedQueryStrategy;
45: return
LineNumberTable:
line 8: 0
line 9: 13
line 5: 26
}</init></init>
Thanks for your report. The symptoms point to a problem in the enum simplification. This optimization replaces enum types by primitive integers, whenever possible. I need to check why the simplification is attempted for this class, when the fromString method should probably make it impossible.
You can work around it by disabling the optimization:
or even: