If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.
![List of issues](/flash/images/issue_list.png)
#2118 Liskov Substitution Principle concerns
Author:
jojusuar
![user user](/flash/images/user.png)
Date created:
Type: other
Visibility: Everybody
Assigned to:
State: new ![Help](/flash/images/help.png)
![Help](/flash/images/help.png)
THIS ISSUE IS POSTED AS A COLLEGE ASSIGNMENT ON SOLID DESIGN PRINCIPLES, PLEASE CLOSE THE
ISSUE IF YOU FIND IT TO BE USELESS.
1. jpexs-decompiler/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java
Concern: Line 218 implements method isFreeing() from interface Freed, but doesn't return a
boolean as it should. This is a LSP violation.
Solution: Return either true or false, since any boolean will make the class behave as the
interface dictates. Proposed code could go as follows:
Public class Cache implements Freed {
@Override
public boolean isFreeing(){
return false
}
}
******************************************************************************************
********************
2.
jpexs-decompiler/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/util/StringUtils
.java
Concern: Line 56 implements method compare() as defined in interface Comparator. However,
it doesn't return an int. This is a LSP violation.
Solution: Define logic to compare Strings in the class. Proposed code could go as
follows:
static class CamelCaseCompare implements Comparator<String>, Serializable {
@Override
public int compare(String o1, String o2) {
if(o1.equals(o2)){
return 0;
}
return o1.length() - o2.length();
}
}
******************************************************************************************
********************
3.
jpexs-decompiler/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MySet
.java
Concern: Line 86 implements method toArray() from interface Set, but doesn't return an
array. This is a LSP violation.
Solution: Write code that converts sets to arrays. Proposed code could go as follows:
import java.util.Set:
class mySet implements Set{
@Override
public <T> T[] toArray(T[] a) {
if (a.length < size()) {
return (T[]) java.util.Arrays.copyOf(elements, size(), a.getClass());
}
System.arraycopy(elements, 0, a, 0, size());
if (a.length > size()) {
a[size()] = null;
}
return a;
}
}
******************************************************************************************
********************