[Scons-users] Javac scan '.java' file less some '.class' file

Bill Deegan bill at baddogconsulting.com
Mon May 27 17:37:09 EDT 2019


I beleive this construct is called "anonymous inner class", is that correct?

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";
            }
        };
    }
}

If so, please change the title of your github issue to "SCons doesn't
properly process anonymous inner class"


On Mon, May 27, 2019 at 7:43 AM 钟文冰 <ZhongWB_95 at 163.com> wrote:

> 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 版邮件 <https://go.microsoft.com/fwlink/?LinkId=550986>应用
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190527/f6810709/attachment.html>


More information about the Scons-users mailing list