Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter CSS property makes compiler crash #38

Closed
carlosrovira opened this issue Mar 30, 2018 · 7 comments
Closed

filter CSS property makes compiler crash #38

carlosrovira opened this issue Mar 30, 2018 · 7 comments
Assignees
Labels
Milestone

Comments

@carlosrovira
Copy link
Contributor

using a css property like

filter: blur(5px);

Makes compilation to crash:

/Users/carlosrovira/Dev/Royale/Source/royale-asjs/examples/royale/JewelExample/src/main/royale/App.mxml]
Internal error: org.apache.royale.compiler.internal.caches.CSSDocumentCache$ProblemParsingCSSRuntimeException org.apache.royale.compiler.internal.caches.CSSDocumentCache$CSSDocumentCacheKey.parse(CSSDocumentCache.java:253)org.apache.royale.compiler.internal.caches.CSSDocumentCache.createEntryValue(CSSDocumentCache.java:337)org.apache.royale.compiler.internal.caches.CSSDocumentCache.createEntryValue(CSSDocumentCache.java:55)org.apache.royale.compiler.internal.caches.ConcurrentCacheStoreBase.get(ConcurrentCacheStoreBase.java:69)org.apache.royale.compiler.internal.caches.CSSDocumentCache.getDefaultsCSS(CSSDocumentCache.java:381)org.apache.royale.compiler.internal.css.CSSManager.getDefaultCSS(CSSManager.java:184)org.apache.royale.compiler.internal.targets.RoyaleJSTarget.getAllDefaultCSS(RoyaleJSTarget.java:289)org.apache.royale.compiler.internal.targets.RoyaleJSTarget.findAllCompilationUnitsToLink(RoyaleJSTarget.java:195)org.apache.royale.compiler.internal.targets.Target.buildAllCompilationUnits(Target.java:297)org.apache.royale.compiler.internal.targets.Target.getBuiltCompilationUnitSet(Target.java:306)org.apache.royale.compiler.internal.targets.JSTarget.buildAndCollectProblems(JSTarget.java:186)org.apache.royale.compiler.internal.targets.JSTarget.build(JSTarget.java:114)org.apache.royale.compiler.internal.targets.JSTarget.build(JSTarget.java:226)org.apache.royale.compiler.clients.MXMLJSCRoyale.buildApplication(MXMLJSCRoyale.java:458)org.apache.royale.compiler.clients.MXMLJSCRoyale.buildJSTarget(MXMLJSCRoyale.java:423)org.apache.royale.compiler.clients.MXMLJSCRoyale.buildArtifact(MXMLJSCRoyale.java:414)org.apache.royale.compiler.clients.MXMLJSCRoyale.compile(MXMLJSCRoyale.java:308)org.apache.royale.compiler.clients.MXMLJSCRoyale._mainNoExit(MXMLJSCRoyale.java:240)org.apache.royale.compiler.clients.MXMLJSCRoyale.mainNoExit(MXMLJSCRoyale.java:197)org.apache.royale.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:345)org.apache.royale.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:281)org.apache.royale.compiler.clients.MXMLJSC.execute(MXMLJSC.java:212)org.apache.royale.maven.BaseMojo.execute(BaseMojo.java:302)org.apache.royale.maven.CompileAppMojo.execute(CompileAppMojo.java:107)org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)org.apache.maven.cli.MavenCli.main(MavenCli.java:194)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

@aharui
Copy link
Contributor

aharui commented Mar 30, 2018

Try adding blur to the FUNCTIONS in CSS.g

@carlosrovira
Copy link
Contributor Author

I added all the possible functions:

FUNCTIONS : '-moz-linear-gradient' | '-webkit-linear-gradient' | 'linear-gradient' | 'progid:DXImageTransform.Microsoft.gradient' | 'translateX' | 'translateY' | 'translate' | 'blur' | 'brightness' | 'contrast' | 'drop-shadow' | 'grayscale' | 'hue-rotate' | 'invert' | 'opacity' | 'saturate' | 'sepia' ;

but maybe something more must be done since the error now is:

/Users/carlosrovira/Dev/Royale/Source/royale-asjs/examples/royale/JewelExample/src/main/royale/App.mxml] Internal error: java.util.NoSuchElementException: can't look backwards more than one token in this stream org.antlr.runtime.misc.LookaheadStream.LB(LookaheadStream.java:159)org.antlr.runtime.misc.LookaheadStream.LT(LookaheadStream.java:120)org.antlr.runtime.RecognitionException.extractInformationFromTreeNodeStream(RecognitionException.java:144)org.antlr.runtime.RecognitionException.<init>(RecognitionException.java:111)org.antlr.runtime.MismatchedTreeNodeException.<init>(MismatchedTreeNodeException.java:42)org.antlr.runtime.tree.TreeParser.recoverFromMismatchedToken(TreeParser.java:135)org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)org.apache.royale.compiler.internal.css.CSSTree.selectorGroup(CSSTree.java:861)org.apache.royale.compiler.internal.css.CSSTree.ruleset(CSSTree.java:782)org.apache.royale.compiler.internal.css.CSSTree.stylesheet(CSSTree.java:289)org.apache.royale.compiler.internal.css.CSSDocument.parse(CSSDocument.java:81)org.apache.royale.compiler.internal.caches.CSSDocumentCache$CSSDocumentCacheKey.parse(CSSDocumentCache.java:251)org.apache.royale.compiler.internal.caches.CSSDocumentCache.createEntryValue(CSSDocumentCache.java:337)org.apache.royale.compiler.internal.caches.CSSDocumentCache.createEntryValue(CSSDocumentCache.java:55)org.apache.royale.compiler.internal.caches.ConcurrentCacheStoreBase.get(ConcurrentCacheStoreBase.java:69)org.apache.royale.compiler.internal.caches.CSSDocumentCache.getDefaultsCSS(CSSDocumentCache.java:381)org.apache.royale.compiler.internal.css.CSSManager.getCSSFromThemes(CSSManager.java:246)org.apache.royale.compiler.internal.targets.RoyaleJSTarget.collectThemes(RoyaleJSTarget.java:239)org.apache.royale.compiler.internal.targets.RoyaleJSTarget.findAllCompilationUnitsToLink(RoyaleJSTarget.java:177)org.apache.royale.compiler.internal.targets.Target.buildAllCompilationUnits(Target.java:297)org.apache.royale.compiler.internal.targets.Target.getBuiltCompilationUnitSet(Target.java:306)org.apache.royale.compiler.internal.targets.JSTarget.buildAndCollectProblems(JSTarget.java:186)org.apache.royale.compiler.internal.targets.JSTarget.build(JSTarget.java:114)org.apache.royale.compiler.internal.targets.JSTarget.build(JSTarget.java:226)org.apache.royale.compiler.clients.MXMLJSCRoyale.buildApplication(MXMLJSCRoyale.java:458)org.apache.royale.compiler.clients.MXMLJSCRoyale.buildJSTarget(MXMLJSCRoyale.java:423)org.apache.royale.compiler.clients.MXMLJSCRoyale.buildArtifact(MXMLJSCRoyale.java:414)org.apache.royale.compiler.clients.MXMLJSCRoyale.compile(MXMLJSCRoyale.java:308)org.apache.royale.compiler.clients.MXMLJSCRoyale._mainNoExit(MXMLJSCRoyale.java:240)org.apache.royale.compiler.clients.MXMLJSCRoyale.mainNoExit(MXMLJSCRoyale.java:197)org.apache.royale.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:345)org.apache.royale.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:281)org.apache.royale.compiler.clients.MXMLJSC.execute(MXMLJSC.java:212)org.apache.royale.maven.BaseMojo.execute(BaseMojo.java:302)org.apache.royale.maven.CompileAppMojo.execute(CompileAppMojo.java:107)org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)org.apache.maven.cli.MavenCli.main(MavenCli.java:194)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

@aharui
Copy link
Contributor

aharui commented Mar 30, 2018

One thing at a time. Just add blur and add a simple test case to CSSTestSource.css and see if you get the same exception

@carlosrovira
Copy link
Contributor Author

carlosrovira commented Mar 30, 2018

I did:

  • Remove all functions except blur
  • added test
    .blurfilter {
    filter: blur(5px)
    }
  • mvn clean install

then royale-compiler build succeed perfectly.

Then compiled example that uses the blur and fails with this:

`Compiling file: /Users/carlosrovira/Dev/Royale/Source/royale-asjs/examples/royale/JewelExample/target/javascript/bin/js-debug/App.js
App as: []
App mxml: [org.apache.royale.core.SimpleCSSValuesImpl, org.apache.royale.core.View, org.apache.royale.jewel.beads.layouts.VerticalLayoutWithPaddingAndGap, org.apache.royale.html.elements.H1, MainContent, App, org.apache.royale.jewel.Application]
Internal error: java.lang.IllegalStateException: Unexpected function call property value: blur(5px) org.apache.royale.compiler.internal.driver.js.royale.JSCSSCompilationSession.encodeRule(JSCSSCompilationSession.java:492)org.apache.royale.compiler.internal.driver.js.royale.JSCSSCompilationSession.encodeCSS(JSCSSCompilationSession.java:204)org.apache.royale.compiler.internal.driver.js.royale.JSCSSCompilationSession.getEncodedCSS(JSCSSCompilationSession.java:59)org.apache.royale.compiler.internal.codegen.mxml.royale.MXMLRoyaleEmitter.postProcess(MXMLRoyaleEmitter.java:385)org.apache.royale.compiler.internal.codegen.mxml.MXMLWriter.writeTo(MXMLWriter.java:75)org.apache.royale.compiler.clients.MXMLJSCRoyale.compile(MXMLJSCRoyale.java:374)org.apache.royale.compiler.clients.MXMLJSCRoyale._mainNoExit(MXMLJSCRoyale.java:240)org.apache.royale.compiler.clients.MXMLJSCRoyale.mainNoExit(MXMLJSCRoyale.java:197)org.apache.royale.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:345)org.apache.royale.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:281)org.apache.royale.compiler.clients.MXMLJSC.execute(MXMLJSC.java:212)org.apache.royale.maven.BaseMojo.execute(BaseMojo.java:302)org.apache.royale.maven.CompileAppMojo.execute(CompileAppMojo.java:107)org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)org.apache.maven.cli.MavenCli.main(MavenCli.java:194)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

`

@aharui
Copy link
Contributor

aharui commented Mar 30, 2018

Also update otherCSSFunctions in JSCSSCompilationSession.java

@carlosrovira
Copy link
Contributor Author

Thanks!That worked :)
I'll updated with the rest of filters

@carlosrovira
Copy link
Contributor Author

Hi Alex,
I must ro remove "opacity" filter since we are already considering the old "opacity" function in CSS
This is the commit:
83fa12f

@carlosrovira carlosrovira added this to the 0.9.3 milestone Apr 9, 2018
@carlosrovira carlosrovira self-assigned this Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants