Jay Ashworth | 1 Nov 2011 05:14
Picon

[groovy-user] Error in generated stub

A co-worker added the ability to hyperlink some of the fields in our
project's UI, but the added class causes an error during the (ant) groovyc
compilation task on _some_ machines.  Nothing seems amiss in the code, but
the generated stub includes a call to 'super(null)' which it then has
difficulty resolving which superclass constructor it should be matching.

'Troublesome' class:

class ClickableFormattedTextField extends JFormattedTextField {
    private Clickable clicker

    ClickableFormattedTextField(JFormattedTextField.AbstractFormatterFactory
factory, Clickable clicker) {
        super(factory)
        this.clicker = clicker

        setForeground(Color.BLUE)
        setDisabledTextColor(Color.BLUE)

        addMouseListener(getClickMouseListener())

        setToolTipText(getText())
    }

    private MouseAdapter getClickMouseListener() {
        new MouseAdapter() {
             <at> Override
            void mouseClicked(MouseEvent e) {
                if (e.getButton() == MouseEvent.BUTTON1) {
                    clicker.click(getText())
(Continue reading)

Jochen Theodorou | 1 Nov 2011 11:31
Picon
Gravatar

Re: [groovy-user] Error in generated stub

Am 01.11.2011 05:14, schrieb Jay Ashworth:
> A co-worker added the ability to hyperlink some of the fields in our
> project's UI, but the added class causes an error during the (ant) groovyc
> compilation task on _some_ machines.  Nothing seems amiss in the code, but
> the generated stub includes a call to 'super(null)' which it then has
> difficulty resolving which superclass constructor it should be matching.

you can help here by casting in the super constructor call:

>          super((AbstractFormatterFactory)factory)

bye blackdrag

--

-- 
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

phil swenson | 1 Nov 2011 15:34
Picon

[groovy-user] suggestions on setting a "read-only" property for test purposes

I have a unit test where I need to set a read-only property to a different value than it has from the setup.


Could someone suggest a method for this?

thanks
phil
Paulo Gabriel Poiati | 1 Nov 2011 16:03
Picon

Re: [groovy-user] suggestions on setting a "read-only" property for test purposes

class Foo  {

    final bar;
    
    Foo(bar) {
        this.bar = bar
    }
    
}

def foo = new Foo(10)

println foo.bar

foo.metaClass.getBar {-> 20}

println foo.bar

[]'s
Paulo Poiati

blog.paulopoiati.com


On Tue, Nov 1, 2011 at 12:34 PM, phil swenson <phil.swenson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I have a unit test where I need to set a read-only property to a different value than it has from the setup.

Could someone suggest a method for this?

thanks
phil

Jay Ashworth | 1 Nov 2011 16:55
Picon

[groovy-user] Re: Error in generated stub

-Nov 01, 2011; 4:31am Jochen Theodorouonline Jochen Theodorou
-
-you can help here by casting in the super constructor call:
-
->          super((AbstractFormatterFactory)factory)

Even with casting, the generated stub is simply 'super(null)'; I even tried
switching it to the two parameter call to the superclass
(JFormattedTextField), of which there is only one.  But, the stub continues
to show 'super(null)'.  

For whatever reason, this class will compile fine for developers using a
Linux environment, but the Windows users fail with the previously stated
error.  

On Linux, the stub is correct:

import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import groovy.lang.*;
import groovy.util.*;

public class ClickableFormattedTextField
  extends javax.swing.JFormattedTextField  implements
    groovy.lang.GroovyObject {
public ClickableFormattedTextField
(javax.swing.JFormattedTextField.AbstractFormatterFactory factory,
dms.client.common.clickers.Clickable clicker) {
super ();       <------ correct 
}
public  groovy.lang.MetaClass getMetaClass() { return
(groovy.lang.MetaClass)null;}
public  void setMetaClass(groovy.lang.MetaClass mc) { }
public  java.lang.Object invokeMethod(java.lang.String method,
java.lang.Object arguments) { return null;}
public  java.lang.Object getProperty(java.lang.String property) { return
null;}
public  void setProperty(java.lang.String property, java.lang.Object value)
{ }

Any further ideas or suggestions?

--
View this message in context: http://groovy.329449.n5.nabble.com/Error-in-generated-stub-tp4954236p4955591.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

phil swenson | 1 Nov 2011 17:41
Picon

Re: [groovy-user] suggestions on setting a "read-only" property for test purposes

thanks, perfect.


any reason to leave the "->" in for "foo.metaClass.getBar {-> 20}"?

On Tue, Nov 1, 2011 at 9:03 AM, Paulo Gabriel Poiati <paulogpoiati-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
class Foo  {

    final bar;
    
    Foo(bar) {
        this.bar = bar
    }
    
}

def foo = new Foo(10)

println foo.bar

foo.metaClass.getBar {-> 20}

println foo.bar

[]'s
Paulo Poiati

blog.paulopoiati.com



On Tue, Nov 1, 2011 at 12:34 PM, phil swenson <phil.swenson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I have a unit test where I need to set a read-only property to a different value than it has from the setup.

Could someone suggest a method for this?

thanks
phil


Jochen Theodorou | 1 Nov 2011 18:42
Picon
Gravatar

Re: [groovy-user] Re: Error in generated stub

Am 01.11.2011 16:55, schrieb Jay Ashworth:
> -Nov 01, 2011; 4:31am Jochen Theodorouonline Jochen Theodorou
> -
> -you can help here by casting in the super constructor call:
> -
> ->           super((AbstractFormatterFactory)factory)
>
> Even with casting, the generated stub is simply 'super(null)'; I even tried
> switching it to the two parameter call to the superclass
> (JFormattedTextField), of which there is only one.  But, the stub continues
> to show 'super(null)'.
>
> For whatever reason, this class will compile fine for developers using a
> Linux environment, but the Windows users fail with the previously stated
> error.

But the Code executed for both systems is in that part the same... strange.

[...]
> Any further ideas or suggestions?

Sorry, no, this kind of error is totally unknown to me

bye blackdrag

--

-- 
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Andrew Eisenberg | 1 Nov 2011 20:30
Gravatar

Re: [groovy-user] Re: Error in generated stub

> Any further ideas or suggestions?

Have you considered moving to the groovy-eclipse batch compiler from ant?

See here for instructions on how to do it:
http://contraptionsforprogramming.blogspot.com/2010/09/where-are-all-my-stubs.html

You will need to download the groovy-eclipse-batch jar from maven, here:
http://search.maven.org/#browse%7C-1075089063

I haven't done extensive testing with the batch compiler from ant, but
it should be working.  Please let me know what your experience is.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

citron | 1 Nov 2011 21:09
Picon
Favicon

[groovy-user] XmlSlurper and variables

Hi,

how can I use a variable to get a value in an xml file with XmlSlurper ?
As long as there is no dot in the path variable it seem to work fine.

What am I doing wrong here?

Thanks!

def xml ="""<root>
<some>
<path>How to get this with the somePath variable?</path>
</some>
<ok>this is working!</ok>
</root>"""

def root = new XmlSlurper().parseText(xml)

//this variable contains no "." and its working fine
def okPath ="ok"

println root."$okPath"

// OK
//println root.some.path

// This is NOT working for some reason.
def somePath ="some.path"

//How to re-write this for the path variable??
println root."$somePath"

-----
Project pages  
AndersTool     
earBuddy 

--
View this message in context: http://groovy.329449.n5.nabble.com/XmlSlurper-and-variables-tp4956180p4956180.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Erik Husby | 1 Nov 2011 21:57
Favicon

Re: [groovy-user] XmlSlurper and variables

root.some.path.text()

On Nov 1, 2011, at 4:09 PM, citron wrote:

> Hi,
> 
> how can I use a variable to get a value in an xml file with XmlSlurper ?
> As long as there is no dot in the path variable it seem to work fine.
> 
> What am I doing wrong here?
> 
> Thanks!
> 
> 
> def xml ="""<root>
> <some>
> <path>How to get this with the somePath variable?</path>
> </some>
> <ok>this is working!</ok>
> </root>"""
> 
> def root = new XmlSlurper().parseText(xml)
> 
> //this variable contains no "." and its working fine
> def okPath ="ok"
> 
> println root."$okPath"
> 
> 
> // OK
> //println root.some.path
> 
> 
> // This is NOT working for some reason.
> def somePath ="some.path"
> 
> //How to re-write this for the path variable??
> println root."$somePath"
> 
> 
> -----
> Project pages  
> AndersTool     
> earBuddy 
> 
> --
> View this message in context: http://groovy.329449.n5.nabble.com/XmlSlurper-and-variables-tp4956180p4956180.html
> Sent from the groovy - user mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 

---
Erik Husby
Senior Software Engineer I
Broad Institute
Rm. 2139, 320 Charles St, Cambridge, MA 02141-2023
mobile: 781.354.6669, office: 617.714.8443
email: mhusby@... Jabber: mhusby@...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Gmane