groovy

import static not supported

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0
  • Fix Version/s: 1.1-beta-1
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, org.jboss.seam.example.jpa.RegisterAction: 3: Unknown type: STATIC_IMPORT at line: 3 column: 1. File: org.jboss.seam.example.jpa.RegisterAction @ line 3, column 1.
1 error

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:326)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:851)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:306)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:275)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:270)
at groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:714)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:673)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:728)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

package org.jboss.seam.example.jpa;

import static org.jboss.seam.ScopeType.EVENT;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.FacesMessages;

@Scope(EVENT)
@Name("register")
class RegisterAction
{

@In
User user;

@In
EntityManager em;

@In
FacesMessages facesMessages;

String verify;

boolean registered;

void register()
{
if ( user.password == verify )
{
existing = em.createQuery('''
select u.username
from User u
where u.username=#{user.username}
''').getResultList()
if (existing.size()==0)
{
em.persist(user)
facesMessages.add("Successfully registered as #{user.username}");
registered = true
}
else
{
facesMessages.addToControl("username", "Username #{user.username} already exists")
}
}
else

{ facesMessages.add("verify", "Re-enter your password") verify=null }

}

void invalid()

{ facesMessages.add("Please try again") }

}

Activity

Hide
Emmanuel added a comment -

Oups, I validated the form too fast

It's based on Wednesday's trunk

Show
Emmanuel added a comment - Oups, I validated the form too fast It's based on Wednesday's trunk
Hide
Guillaume Laforge added a comment -

Static imports aren't supported yet.
But might be in a future beta.

Show
Guillaume Laforge added a comment - Static imports aren't supported yet. But might be in a future beta.
Hide
Emmanuel added a comment -

hence the title

Show
Emmanuel added a comment - hence the title
Hide
Paul King added a comment -

Please try again with the 1.1-beta to be released in the next week (or a snapshot release of HEAD)

Show
Paul King added a comment - Please try again with the 1.1-beta to be released in the next week (or a snapshot release of HEAD)
Hide
Paul King added a comment -

No immediate feedback, assuming working. Can be reopened if issues found.

Show
Paul King added a comment - No immediate feedback, assuming working. Can be reopened if issues found.
Hide
Emmanuel added a comment -

Sorry for the delay Paul.
It works indeed!

Thanks

Show
Emmanuel added a comment - Sorry for the delay Paul. It works indeed! Thanks

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: