-
Notifications
You must be signed in to change notification settings - Fork 24
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
fixed prematurely read issue of assignability analysis #190
base: develop
Are you sure you want to change the base?
Conversation
...lidate/src/test/java/org/opalj/fpcf/fixtures/xl/js/sandbox/JSAllocationWriteFieldFromJS.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the comments in the code, the tests fail with this PR, please have a look why and make sure tests succeed, as otherwise this can't be merged.
...cala/org/opalj/tac/fpcf/analyses/fieldassignability/AbstractFieldAssignabilityAnalysis.scala
Outdated
Show resolved
Hide resolved
|
||
if (field.isPublic) | ||
if (field.isPublic && !field.isFinal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be easier and more readable to just wrap the entire section into a separate if (!field.isFinal)
?
} else { | ||
receiverVar.isDefined && receiverVar.get.definedBy != SelfReferenceParameter | ||
} | ||
if (method.isInitializer && method.classFile == field.classFile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part of the code needs documentation to understand what all of the different conditions do
} else | ||
receiverVar.get | ||
|
||
// When there are more than 1 definitionsite, we soundly return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix grammar ("If there is more than one definition site, we soundly return true")
val stmt = stmts(index) | ||
|
||
fieldWriteInMethodIndex == index || // The value is itself written to another object | ||
// IMPROVE: Can we use field access information to care about reflective accesses here? | ||
stmt.isPutField && stmt.asPutField.name != state.field.name || | ||
stmt.isAssignment && stmt.asAssignment.targetVar == assignedValueObjectVar || | ||
// stmt.isAssignment && stmt.asAssignment.targetVar == assignedValueObjectVar || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this code commented out? Was this done for debugging reasons and should be reinstantiated? Or is the commented out code wrong and not needed and should be removed?
|
||
C() { | ||
super(); | ||
//this.b(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this commented out? If it is needed, reinstantiate it, if it is unnecessary, remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the example Marc gave me. I will remove the outcommented code as well as the function b()
static int n = 5; | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Value A.X before constructor:" + PrematurelyReadOfFinalField.n); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these printlns necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove them.
…m/opalj/opal into fix/assignability-prematurelyRead
No description provided.