-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic inheritence test. Asserts are still missing
- Loading branch information
Showing
13 changed files
with
138 additions
and
19 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
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
Binary file added
BIN
+227 Bytes
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/AnotherExtendedClass.class
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/AnotherExtendedClass.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,4 @@ | ||
package mypackage; | ||
|
||
public class AnotherExtendedClass extends BaseClass { | ||
} |
Binary file added
BIN
+536 Bytes
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/Application.class
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/Application.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,18 @@ | ||
package mypackage; | ||
|
||
public class Application { | ||
|
||
public void init() { | ||
var extended = new ExtendedClass(); | ||
extended.setMyProperty(10); | ||
|
||
BaseClass base; | ||
if(Math.random() == 1.0) { | ||
base = (BaseClass) extended; | ||
} else { | ||
base = new AnotherExtendedClass(); | ||
} | ||
base.setMyProperty(10); | ||
} | ||
|
||
} |
Binary file added
BIN
+382 Bytes
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/BaseClass.class
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/BaseClass.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,14 @@ | ||
package mypackage; | ||
|
||
public class BaseClass { | ||
|
||
public int getMyProperty() { | ||
return myProperty; | ||
} | ||
|
||
public void setMyProperty(int myProperty) { | ||
this.myProperty = myProperty; | ||
} | ||
|
||
protected int myProperty = 5; | ||
} |
Binary file added
BIN
+1018 Bytes
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/ExtendedClass.class
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
cpg-language-jvm/src/test/resources/class/inheritence/mypackage/ExtendedClass.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,14 @@ | ||
package mypackage; | ||
|
||
public class ExtendedClass extends BaseClass { | ||
|
||
public void setMyProperty(int myProperty) { | ||
informSomebody(this.myProperty, myProperty); | ||
super.setMyProperty(myProperty); | ||
} | ||
|
||
private void informSomebody(int oldValue, int newValue) { | ||
System.out.println("We changed the value from " + oldValue + " to " + newValue); | ||
} | ||
|
||
} |
Binary file not shown.