[Scons-users] Javac scan '.java' file less some '.class' file
钟文冰
ZhongWB_95 at 163.com
Mon May 27 10:43:14 EDT 2019
Javac scan '.java' file less some '.class' file
* Version of SCons ------------------------------- 3.0.5
* Version of Python ------------------------------- 3.7.0
* Version of JDK ----------------------------------- 1.8.0_144
* Which python distribution if applicable -------- python.org
* How you installed SCons -------- python setup.py install
* What Platform are you on? ---------------------- Windows 7
* How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues.
1 . less Generic class
--------------------------------SConstruct---
print([str(cls) for cls in Java('.','.')])
--------------------------------Example_demo.java--
package bag;
import bag.MyInterface;
import java.util.*;
public class Example_demo{
public static void pppp() {
MyInterface<List<String>> obj = null;
obj = new MyInterface<List<String>>() {
@Override
public String getName() {
return "MyInterface";
}
public String value() {
return "ABC";
}
};
}
}
--------------------------------MyInterface.java--
package bag;
interface MyInterface<T> {
public String getName();
}
* How you invoke scons (The command line you're using "scons --flags some_arguments")
scons
scons ouput -------------------->
['bag\\Example_demo.class', 'bag\\MyInterface.class']
This generates three class files:
['bag\\Example_demo$1.class', 'bag\\Example_demo.class', 'bag\\MyInterface.class']
but scons does not know about the first one, so it is not included in the jar.
----------------------------------------------------------------------------------
I suggest modifying the file scons\SCons\Tool\JavaCommon.py
Line 63 “ _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;\.\(\)]|' +
r'\d*\.\d*|[A-Za-z_][\w\$\.]*|<[A-Za-z_]\w+>|' +
r'/\*|\*/|\[\])')”
to “ _reToken = re.compile(r'(\n|\\\\|//|\\[\'"]|[\'"\{\}\;\.\(\)]|' +
r'\d*\.\d*|[A-Za-z_][\w\$\.]*|<[A-Za-z_][\w<>]+>|' +
r'/\*|\*/|\[\])')”
2 . less Generic class
--------------------------------SConstruct---
print([str(cls) for cls in Java('.','.')])
--------------------------------FinalCls.java--
public final class FinalCls {
private static class InnerSubClass extends Object {
public String toString() {
return "InnerSubClass of FinalCls";
}
}
public static final Object STATIC_FINAL_OBJ = new InnerSubClass();
}
* How you invoke scons (The command line you're using "scons --flags some_arguments")
scons
scons ouput -------------------->
['FinalCls$InnerSubClass.class', 'FinalCls.class']
This generates three class files:
['FinalCls$1.class', 'FinalCls$InnerSubClass.class', 'FinalCls.class']
but scons does not know about the first one, so it is not included in the jar.
-----------------------------------------------------------------------------------
Lost files(FinalCls$1.class) do not seem to affect the execution of the program
发送自 Windows 10 版邮件应用
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190527/036ceefc/attachment.html>
More information about the Scons-users
mailing list