Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7de4fe3

Browse files
author
grau
committedAug 4, 2021
Check for same class names differing only in case
1 parent 8290967 commit 7de4fe3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

Diff for: ‎src/org/deepjava/classItems/Class.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.deepjava.config.Segment;
2727
import org.deepjava.host.ClassFileAdmin;
2828
import org.deepjava.host.Dbg;
29+
import org.deepjava.host.StdStreams;
2930
import org.deepjava.linker.FixedValueEntry;
3031
import org.deepjava.strings.HString;
3132

@@ -123,7 +124,17 @@ public Class(HString registeredCpClassName) {
123124
* all imported classes in the constant pool are loaded as well
124125
*/
125126
protected void loadClass(int userReqAttributes) {
126-
// boolean dbg = true;
127+
{ // check if this class has a similar name as an already loaded class (differing in small / capital letters only)
128+
// this is important under Windows, as e.g. test/Test and test/TEst would load the same class file
129+
Item item = RefType.refTypeList;
130+
while (item != null) {
131+
if (item.name.toString().toLowerCase().equals(name.toString().toLowerCase()) && !item.name.equals(name)) {
132+
StdStreams.err.println("class " + item.name + " loaded: loads the same class file as " + name.toString() + ", please check name of root class");
133+
}
134+
item = item.next;
135+
}
136+
}
137+
127138
if (CFR.clsDbg) vrb.println("load class: " + name);
128139
if (dbg) vrb.println(">loadClass: " + name);
129140
if ((accAndPropFlags & (1<<dpfClassLoaded)) == 0 ) { // if not yet loaded and not synthetic

0 commit comments

Comments
 (0)
Please sign in to comment.