rascal icon indicating copy to clipboard operation
rascal copied to clipboard

URL encodings at unexpected places in M3.methodInvocation

Open verhoofstad opened this issue 8 years ago • 5 comments

After loading the JDK with createM3FromJar() the methodInvocation relation contains URL escape characters at the beginning of the path.

Note the method locations in the range of the relation. They contain %5B right after the triple /// in their path.

Additionally, a semicolon is inserted in the target of the last method invocation.

rel[loc from,loc to]: {
  <|java+constructor:///sun/security/krb5/internal/MethodData/MethodData(int,byte%5B%5D)|,|java+method:///%5BB/clone()|>,
  <|java+method:///sun/security/provider/SHA2/clone()|,|java+method:///%5BI/clone()|>,
  <|java+method:///sun/security/util/DisabledAlgorithmConstraints$KeySizeConstraint$Operator/values()|,|java+method:///%5BLsun/security/util/DisabledAlgorithmConstraints$KeySizeConstraint$Operator;/clone()|>,
...

There were over 1000 method invocation for which this occurred. In all of them an invocation to clone() was made.

verhoofstad avatar Nov 12 '17 13:11 verhoofstad

According to the Java language Specification, Java SE 9:

In the Java programming language, arrays are objects (§4.3.1), are dynamically created, and may be assigned to variables of type Object (§4.3.2). All methods of class Object may be invoked on an array.

Given this statement we can assume that when the clone() method is invoked on an array (identified as [<type> in Java bytecode), we must refer to the class Object. Then, there is a new modelling alternative:

rel[loc from,loc to]: {
  <|java+constructor:///sun/security/krb5/internal/MethodData/MethodData(int,byte%5B%5D)|,|java+method:///java/lang/Object/clone()|>,
  <|java+method:///sun/security/provider/SHA2/clone()|,|java+method:///java/lang/Object/clone()|>,
  <|java+method:///sun/security/util/DisabledAlgorithmConstraints$KeySizeConstraint$Operator/values()|,|java+method:///java/lang/Object/clone()|>,
...

@jurgenvinju what is your advice on this matter?

lmove avatar Nov 16 '17 10:11 lmove

I don't know; can we simplify this Safely as Lina says?

jurgenvinju avatar Feb 09 '20 13:02 jurgenvinju

Wondering what the state of this issue is. Did we fix this @lmove ?

jurgenvinju avatar Mar 26 '23 12:03 jurgenvinju

@jurgenvinju, I believe we haven't. Can look into this issue in the coming days. Sounds good?

lmove avatar Mar 27 '23 05:03 lmove

do it if you can use a change of scenery and a small thing to focus on; there is no urgency now; I came across it while preparing for yesterday and thought maybe we have fixed this already.

jurgenvinju avatar Mar 30 '23 09:03 jurgenvinju

solved on a soon-to-be-merged branch

jurgenvinju avatar Apr 26 '24 11:04 jurgenvinju