by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Manfred Tremmel
    @ManfredTremmel_gitlab
    Hi together, I'm working an the apt based code generation for gwt-bean-validators -> https://gitlab.com/ManfredTremmel/gwt-bean-validators/-/tree/feature/Java_Annotation_Processing_for_Code_generation . The good news is, today I managed to get code generator working for Beans included from external projects. The bad news is, it doesn't work for Beans in the same project.
    Background I need the compiled class which was available in the old gwt code generator (java compiler was running before gwt compiler), but not within the apt code generation (annotation processing is running before java compiler).
    Has anybody any ideas to work around the problem or do I have to rewrite all the stuff to work with TypeMirror/TypeElement?
    Frank Hossfeld
    @FrankHossfeld
    @ManfredTremmel_gitlab you can give me a pm … But I will be at dinner now … so the answer will take some time.
    Manfred Tremmel
    @ManfredTremmel_gitlab
    @FrankHossfeld it's not time critical, whenever you are ready
    Frank Hossfeld
    @FrankHossfeld
    I’ll be tomorrow online …
    Colin Alworth
    @niloc132
    i'm around now - but in my experience you do need to rewrite to refer to the actual type declaration (Element) or usage (TypeMirror), depending on context
    i think there are some general utils that have been written to do things that wrap Types and Elements and a name, but there are still cases that gwt's own type model supports which are impossible or impractical, mostly "get all subclasses of X"
    Dmitrii Tikhomirov
    @treblereel
    "get all subclasses of X" is a tricky part, i need to check how i did it for gwt-validation port ...
    Colin Alworth
    @niloc132
    do you need that for validation?
    rpc has a way to do it, but it is ugly, requires that your (polymorphic) beans are either all in a text file, or in the same source as your actual rpc method
    Dmitrii Tikhomirov
    @treblereel
    yeap, there was a reason but i can't remember why :)
    Manfred Tremmel
    @ManfredTremmel_gitlab
    I still hope, there is a workaround. In the current version I load the class with Class.forName() and can generate a BeanDescriptor with Validator. Works like it should if class file exists (all 302 tests for beans out of mt-bean-validators are green), but fails if not. Rewriting the stuff will take a while...
    Miroslav Pokorny
    @mP1
    Crazy question, why not expose all the validators as static methods and call them from inside the setter of the bean ? That way theres no need for an APT, and its basically the same stuff to type and its actually type safe ?
    Colin Alworth
    @niloc132
    @mP1 jsr303 validation is more flow sync pattern than "instant feedback for doing something wrong" - plus with putting logic in setters, you can't handle cases like "if X is Other then Y cannot be null and vice versa"
    Miroslav Pokorny
    @mP1
    yes but problems cause more time like what Manfred has hit, than the saving.
    Colin Alworth
    @niloc132
    @ManfredTremmel_gitlab if i understand your problem, you just want a "get this class by name and let me reflect on it"?
    if so, the Elements type totally supports that
    @mP1 yeah, but the idea isn't "whats the easiest way to solve the problem in this one specific codebase" but "how do i make a tool that follows a standard java spec and lets everyone use it in some form or another"
    Miroslav Pokorny
    @mP1
    being a java standard doesnt make it good, look at ejb v1 / v2.
    Colin Alworth
    @niloc132
    since there is lots of existing code out there which uses just simple stuff like "before we even call the server... is this bean and its contents sane?"
    no, but being a java standard doesnt make it bad either
    Miroslav Pokorny
    @mP1
    my point being is that being a java standard is irrelevant here.. because calling a helper is standard java as well
    which is why i suggested simply calling a helper is a simpler solution and its type safe, somethign annotations are not.
    Manfred Tremmel
    @ManfredTremmel_gitlab
    Hi @niloc132 yes getting the Class<?> of the Bean to validate is my point. My problem is, the code generation is done before the java compile so the class doesn't exist, the order as far as I understood is
    apt processor -> java compiler -> gwt code generator -> gwt compiler
    so getting the class file was no problem in the gwt code generator, but in the case of apt code generation it is not existing. Validating beans from other projects already works.
    In the case I have the Class<?> I can use a lot of functionality of hibernate-validator and needn't implement my own for TypeMirror/TypeElement.
    Chris Ainsley
    @ainslec
    I'm looking for IntersectionObserver in elemental2/dom, but it's not there.
    Colin Alworth
    @niloc132
    @ManfredTremmel_gitlab yes, you cannot use the Class instance, you must use mirrors (or, mostly elements)
    there is a danger of using Class instances - the annotation processor may not rerun if the actual Element doesnt change
    i.e. if you have beans <- validators <- app as three projects, and beans changes, but not in a way that validators needs to rebuild, then your actual validation impl will not be regenerated
    instead you want to keep beans and validators in the same sources, so that when the Element of a bean changes, the processor can be instructed to notice and rebuild the generated code
    Chris Ainsley
    @ainslec
    It's ok, I wrote my own wrapper
    Colin Alworth
    @niloc132
    looks like closure has externs for it, but elemental2 doesnt yet emit java
    browser support looks decent, i think it would be a simple patch to get this accepted into elemental2 - or else making it into its own jar briefly by just running the jsinterop-generator
    Chris Ainsley
    @ainslec
    I just wrote my own JsInterop in the end. Seems to work. Probably not a perfect mapping onto the API, quite impressed it worked first time though.
    Colin Alworth
    @niloc132
    makes sense - api looks light enough that it should be easy to do. consider sharing it, even if just as a gist or something so others can try it quickly?
    Thomas Broyer
    @tbroyer
    FYI: https://blog.ltgt.net/reverse-engineering-j2cl-bazel-integration/ (almost 4½ years since my last blog post!)
    Manfred Tremmel
    @ManfredTremmel_gitlab
    @ainslec I'm using IntersectionObserver in my Lazy Loading Image widget, at the moment it needs a view lines of JSNI: https://gitlab.com/ManfredTremmel/gwt-bean-validators/-/blob/master/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/ImageLazyLoading.java
    Dmitrii Tikhomirov
    @treblereel
    @tbroyer nice article
    Miroslav Pokorny
    @mP1
    ive implemented using Apache Harmony a few of the java.net classes. -> https://github.com/mP1/j2cl-java-net
    sdhaliwal
    @sdhaliwal
    gwt-snapshot repo here This repo seems to be down https://repo.vertispan.com/ seems to be down. Is anybody else having an issue
    Colin Alworth
    @niloc132
    @sdhaliwal yes, the hosting provider had some ... unexpected downtime
    it should be back now?
    sanoobdesign008
    @sanoobdesign008

    @niloc132
    How we can use @media CSS property in GWT framework?

    @media only screen and (max-width: 600px) {
    body {
    background-color: lightblue;
    }
    }

    Colin Alworth
    @niloc132
    @sanoobdesign008 you can use any css that your browser supports, at least in a plain css file
    i'm not sure about putting that in a .gss file though (and certainly the old css resource will not support it, you'll at least need gss, and possibly you'll need to whitelist that at-rule
    Rafał Podgórski
    @ravpod
    Hi, can someone help me? I've updated Java from 8 to 11 and changed GWT version from 2.7.0 to 2.9.0. When I try to run my application I get the following bug:
    [ERROR] jreLeakPrevention.gcDaemonFail
    java.lang.ClassNotFoundException: sun.misc.GC
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:315)
        at com.google.gwt.dev.shell.jetty.JettyLauncher.jreLeakPrevention(JettyLauncher.java:899)
        at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:722)
        at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
        at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:898)
        at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:705)
        at com.google.gwt.dev.DevMode.main(DevMode.java:432)
    2020-07-08 21:06:09,499 INFO  org.eclipse.jetty.server.Server - jetty-9.2.14.v20151106
       [WARN] 
    java.lang.NullPointerException
        at java.base/java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
        at org.eclipse.jetty.annotations.ClassInheritanceHandler.addToInheritanceMap(ClassInheritanceHandler.java:72)
        at org.eclipse.jetty.annotations.ClassInheritanceHandler.handle(ClassInheritanceHandler.java:58)
        at org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor.visit(AnnotationParser.java:480)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:533)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
        at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
        at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)
        at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)
        at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
        at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
        at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.base/java.lang.Thread.run(Thread.java:834)
       [WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@7d2316f3{/,file:/C:/Users/rafal/AppData/Local/JetBrains/IntelliJIdea2020.1/gwt/peakonebase.ee6638f6/peakone-GWT.b2b4d879/run/www/,STARTING}{C:\Users\rafal\AppData\Local\JetBrains\IntelliJIdea2020.1\gwt\peakonebase.ee6638f6\peakone-GWT.b2b4d879\run\www}
    java.lang.RuntimeException: Error scanning entry module-info.class from jar file:/C:/Users/rafal/AppData/Local/JetBrains/IntelliJIdea2020.1/gwt/peakonebase.ee6638f6/peakone-GWT.b2b4d879/run/www/WEB-INF/lib/jackson-annotations-2.11.0.jar
        at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913)
        at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
        at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
        at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.UnsupportedOperationException: This feature requires ASM6
        at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:130)
        at org.objectweb.asm.ClassReader.readModuleAttributes(ClassReader.java:724)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:544)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
        at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
        at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry
    Colin Alworth
    @niloc132
    @ravpod java.lang.ClassNotFoundException: sun.misc.GC can be entirely ignored
    it is just noisy, but fine
    the asm6 error probably means you are mixing classpaths - your own jetty with gwt's jetty and compiler
    the NPE i'm not sure about