[jira] [Comment Edited] (GROOVY-5728) Accessing private constructor from a static factory

2017-02-08 Thread JIRA

[ 
https://issues.apache.org/jira/browse/GROOVY-5728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857927#comment-15857927
 ] 

Peter Myrén edited comment on GROOVY-5728 at 2/8/17 3:27 PM:
-

Same problem with static nested class.
{code}
public abstract class FooMain {
private FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMainNested();
}
public static void main(String[] args) {
System.out.println(factory().bar());
}

   private static class FooMainNested extends FooMain{
public String bar() { return "xxx"; }
   }
}

{code}

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8


was (Author: petermyren):
Same problem with non anonymous inner class.
{code}
public abstract class FooMain {
private FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMainNested();
}
public static void main(String[] args) {
System.out.println(factory().bar());
}

   private static class FooMainNested extends FooMain{
public String bar() { return "xxx"; }
   }
}

{code}

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8

> Accessing private constructor from a static factory
> ---
>
> Key: GROOVY-5728
> URL: https://issues.apache.org/jira/browse/GROOVY-5728
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.0.4, 2.4.0-beta-3
>Reporter: Paul King
>Priority: Minor
>
> The following code works fine from Java but fails in Groovy:
> {code}
> public abstract class FooMain {
> private FooMain() {}
> public abstract String bar();
> public static FooMain factory() {
>   return new FooMain() {
> public String bar() { return "xxx"; }
>   };
> }
> public static void main(String[] args) {
> System.out.println(factory().bar());
> }
> }
> // => java.lang.IllegalAccessError: tried to access method FooMain.()V 
> from class FooMain$1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (GROOVY-5728) Accessing private constructor from a static factory

2017-02-08 Thread JIRA

[ 
https://issues.apache.org/jira/browse/GROOVY-5728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857927#comment-15857927
 ] 

Peter Myrén edited comment on GROOVY-5728 at 2/8/17 3:10 PM:
-

Same problem with non anonymous inner class.
{code}
public abstract class FooMain {
private FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMainNested();
}
public static void main(String[] args) {
System.out.println(factory().bar());
}

   private static class FooMainNested extends FooMain{
public String bar() { return "xxx"; }
   }
}

{code}

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8


was (Author: petermyren):
Same problem with non anonymous inner class.

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8

> Accessing private constructor from a static factory
> ---
>
> Key: GROOVY-5728
> URL: https://issues.apache.org/jira/browse/GROOVY-5728
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.0.4, 2.4.0-beta-3
>Reporter: Paul King
>Priority: Minor
>
> The following code works fine from Java but fails in Groovy:
> {code}
> public abstract class FooMain {
> private FooMain() {}
> public abstract String bar();
> public static FooMain factory() {
>   return new FooMain() {
> public String bar() { return "xxx"; }
>   };
> }
> public static void main(String[] args) {
> System.out.println(factory().bar());
> }
> }
> // => java.lang.IllegalAccessError: tried to access method FooMain.()V 
> from class FooMain$1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (GROOVY-5728) Accessing private constructor from a static factory

2017-02-08 Thread JIRA

[ 
https://issues.apache.org/jira/browse/GROOVY-5728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857927#comment-15857927
 ] 

Peter Myrén edited comment on GROOVY-5728 at 2/8/17 3:43 PM:
-

Same problem with static nested class.
{code}
public abstract class FooMain {
private FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMainNested();
}
public static void main(String[] args) {
System.out.println(factory().bar());
}

   private static class FooMainNested extends FooMain{
public String bar() { return "xxx"; }
   }
}

{code}
This is expected, since nested static classes can't access private variables 
and methods. But, this also fails:
{code}
public class FooMain {

private FooMain() {}

public String bar(){return null;}

public static FooMain factory() {
return new FooMainNested(new FooMain());
};

public static void main(String[] args) {
System.out.println(factory().bar());
}

private class FooMainNested extends FooMain{

@Override
public String bar() {
return "xxx";
}
}

}
{code}

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8


was (Author: petermyren):
Same problem with static nested class.
{code}
public abstract class FooMain {
private FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMainNested();
}
public static void main(String[] args) {
System.out.println(factory().bar());
}

   private static class FooMainNested extends FooMain{
public String bar() { return "xxx"; }
   }
}

{code}

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8

> Accessing private constructor from a static factory
> ---
>
> Key: GROOVY-5728
> URL: https://issues.apache.org/jira/browse/GROOVY-5728
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.0.4, 2.4.0-beta-3
>Reporter: Paul King
>Priority: Minor
>
> The following code works fine from Java but fails in Groovy:
> {code}
> public abstract class FooMain {
> private FooMain() {}
> public abstract String bar();
> public static FooMain factory() {
>   return new FooMain() {
> public String bar() { return "xxx"; }
>   };
> }
> public static void main(String[] args) {
> System.out.println(factory().bar());
> }
> }
> // => java.lang.IllegalAccessError: tried to access method FooMain.()V 
> from class FooMain$1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (GROOVY-8067) Possible deadlock when creating new ClassInfo entries in the cache

2017-02-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15858505#comment-15858505
 ] 

ASF GitHub Bot commented on GROOVY-8067:


Github user jwagenleitner commented on a diff in the pull request:

https://github.com/apache/groovy/pull/489#discussion_r100162935
  
--- Diff: 
subprojects/stress/src/test/java/org/codehaus/groovy/reflection/ClassInfoDeadlockStressTest.java
 ---
@@ -0,0 +1,140 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.reflection;
+
+import groovy.lang.GroovyClassLoader;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.groovy.stress.util.GCUtils;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Tests for deadlocks in the ClassInfo caching.
+ *
+ */
+public class ClassInfoDeadlockStressTest {
+
+private static final int DEADLOCK_TRIES = 8;
+private static final int THREAD_COUNT = 8;
+
+private final CountDownLatch startLatch = new CountDownLatch(1);
+private final CountDownLatch completeLatch = new 
CountDownLatch(THREAD_COUNT);
+private final GroovyClassLoader gcl = new GroovyClassLoader();
+private final AtomicInteger counter = new AtomicInteger();
+
+/**
+ * We first generate a large number of ClassInfo instances for classes
+ * that are no longer reachable.  Then queue up threads to all request
+ * ClassInfo instances for new classes simultaneously to ensure that
+ * clearing the old references wont deadlock the creation of new
+ * instances.
+ * 
+ * GROOVY-8067
+ */
+@Test
+public void testDeadlock() throws Exception {
+for (int i = 1; i <= DEADLOCK_TRIES; i++) {
+System.out.println("Test Number: " + i);
+generateGarbage();
+GCUtils.gc();
+attemptDeadlock(null);
+}
+}
+
+@Test
+public void testRequestsForSameClassInfo() throws Exception {
+Class newClass = createRandomClass();
+for (int i = 1; i <= DEADLOCK_TRIES; i++) {
+System.out.println("Test Number: " + i);
+generateGarbage();
+GCUtils.gc();
+attemptDeadlock(newClass);
+}
+ClassInfo newClassInfo = ClassInfo.getClassInfo(newClass);
+for (ClassInfo ci : ClassInfo.getAllClassInfo()) {
+if (ci.getTheClass() == newClass && ci != newClassInfo) {
+fail("Found multiple ClassInfo instances for class");
+}
+}
+}
+
+private void attemptDeadlock(final Class cls) throws Exception {
+for (int i = 0; i < THREAD_COUNT; i++) {
+Runnable runnable = new Runnable() {
+@Override
+public void run() {
+Class newClass = (cls == null) ? 
createRandomClass() : cls;
+try {
+startLatch.await();
+} catch (InterruptedException ie) {
--- End diff --

can use `ThreadUtils.awaite()`


> Possible deadlock when creating new ClassInfo entries in the cache
> --
>
> Key: GROOVY-8067
> URL: https://issues.apache.org/jira/browse/GROOVY-8067
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.4.8
>Reporter: John Wagenleitner
>Priority: Critical
> Attachments: ClassInfoDeadlockTest.java
>
>
> When running Groovy without {{-Dgroovy.use.classvalue=true}} the ClassInfo 
> instances are cached in a {{ManagedConcurrentMap}} (MCM).  New values are 

[jira] [Commented] (GROOVY-8067) Possible deadlock when creating new ClassInfo entries in the cache

2017-02-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15858506#comment-15858506
 ] 

ASF GitHub Bot commented on GROOVY-8067:


Github user jwagenleitner commented on a diff in the pull request:

https://github.com/apache/groovy/pull/489#discussion_r100162813
  
--- Diff: 
src/main/org/codehaus/groovy/util/ManagedConcurrentLinkedQueue.java ---
@@ -0,0 +1,187 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * A queue that stores the values wrapped in a Reference, the type of 
which is
+ * determined by the provided {@link ReferenceBundle}.  Values stored in 
this queue
+ * that are put on the {@code ReferenceQueue} will be removed from the 
list when
+ * reference processing for the {@code ReferenceQueue} is done.
+ *
+ * This queue is backed by a {@link ConcurrentLinkedQueue} and is thread 
safe.  The
+ * iterator will only return non-null values (reachable) and is based on 
the
+ * "weakly consistent" iterator of the underlying {@link 
ConcurrentLinkedQueue}.
+ *
+ * @param  the type of values to store
+ */
+public class ManagedConcurrentLinkedQueue implements Iterable {
+
+private final ReferenceBundle bundle;
+private final ConcurrentLinkedQueue queue;
+
+/**
+ * Creates an empty ManagedConcurrentLinkedQueue that will use the 
given
+ * {@code ReferenceBundle} to store values as the given Reference
+ * type.
+ *
+ * @param bundle used to create the appropriate Reference type
+ *   for the values stored
+ */
+public ManagedConcurrentLinkedQueue(ReferenceBundle bundle) {
+this.bundle = bundle;
+this.queue = new ConcurrentLinkedQueue();
+}
+
+/**
+ * Adds the specified value to the queue.
+ *
+ * @param value the value to add
+ */
+public void add(T value) {
+Element e = new Element(value);
+queue.offer(e);
+}
+
+/**
+ * Returns {@code true} if this queue contains no elements.
+ * 
+ * This method does not check the elements to verify they contain
+ * non-null reference values.
+ */
+public boolean isEmpty() {
+return queue.isEmpty();
+}
+
+/**
+ * Returns an array containing all values from this queue in the 
sequence they
+ * were added.
+ *
+ * @param tArray the array to populate if big enough, else a new array 
with
+ *   the same runtime type
+ * @return an array containing all non-null values in this queue
+ */
+public T[] toArray(T[] tArray) {
+return values().toArray(tArray);
+}
+
+/**
+ * Returns an unmodifiable list containing all values from this queue 
in the
+ * sequence they were added.
+ */
+public List values() {
+Iterator itr = iterator();
+if (!itr.hasNext()) {
+return Collections.emptyList();
+}
+List result = new ArrayList(100);
+result.add(itr.next());
+while (itr.hasNext()) {
+result.add(itr.next());
+}
+return Collections.unmodifiableList(result);
+}
+
+/**
+ * Returns an iterator over all non-null values in this queue.  The 
values should be
+ * returned in the order they were added.
+ */
+@Override
+public Iterator iterator() {
+return new Iter(queue.iterator());
+}
+
+private final class 

[GitHub] groovy pull request #489: GROOVY-8067: Possible deadlock when creating new C...

2017-02-08 Thread jwagenleitner
Github user jwagenleitner commented on a diff in the pull request:

https://github.com/apache/groovy/pull/489#discussion_r100162935
  
--- Diff: 
subprojects/stress/src/test/java/org/codehaus/groovy/reflection/ClassInfoDeadlockStressTest.java
 ---
@@ -0,0 +1,140 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.reflection;
+
+import groovy.lang.GroovyClassLoader;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.groovy.stress.util.GCUtils;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Tests for deadlocks in the ClassInfo caching.
+ *
+ */
+public class ClassInfoDeadlockStressTest {
+
+private static final int DEADLOCK_TRIES = 8;
+private static final int THREAD_COUNT = 8;
+
+private final CountDownLatch startLatch = new CountDownLatch(1);
+private final CountDownLatch completeLatch = new 
CountDownLatch(THREAD_COUNT);
+private final GroovyClassLoader gcl = new GroovyClassLoader();
+private final AtomicInteger counter = new AtomicInteger();
+
+/**
+ * We first generate a large number of ClassInfo instances for classes
+ * that are no longer reachable.  Then queue up threads to all request
+ * ClassInfo instances for new classes simultaneously to ensure that
+ * clearing the old references wont deadlock the creation of new
+ * instances.
+ * 
+ * GROOVY-8067
+ */
+@Test
+public void testDeadlock() throws Exception {
+for (int i = 1; i <= DEADLOCK_TRIES; i++) {
+System.out.println("Test Number: " + i);
+generateGarbage();
+GCUtils.gc();
+attemptDeadlock(null);
+}
+}
+
+@Test
+public void testRequestsForSameClassInfo() throws Exception {
+Class newClass = createRandomClass();
+for (int i = 1; i <= DEADLOCK_TRIES; i++) {
+System.out.println("Test Number: " + i);
+generateGarbage();
+GCUtils.gc();
+attemptDeadlock(newClass);
+}
+ClassInfo newClassInfo = ClassInfo.getClassInfo(newClass);
+for (ClassInfo ci : ClassInfo.getAllClassInfo()) {
+if (ci.getTheClass() == newClass && ci != newClassInfo) {
+fail("Found multiple ClassInfo instances for class");
+}
+}
+}
+
+private void attemptDeadlock(final Class cls) throws Exception {
+for (int i = 0; i < THREAD_COUNT; i++) {
+Runnable runnable = new Runnable() {
+@Override
+public void run() {
+Class newClass = (cls == null) ? 
createRandomClass() : cls;
+try {
+startLatch.await();
+} catch (InterruptedException ie) {
--- End diff --

can use `ThreadUtils.awaite()`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (GROOVY-8085) Exception in "finally" not caught by outer "try"

2017-02-08 Thread Craig Silverstein (JIRA)
Craig Silverstein created GROOVY-8085:
-

 Summary: Exception in "finally" not caught by outer "try"
 Key: GROOVY-8085
 URL: https://issues.apache.org/jira/browse/GROOVY-8085
 Project: Groovy
  Issue Type: Bug
Affects Versions: 2.4.8
 Environment: linux
Reporter: Craig Silverstein


I would expect the following code to print `caughtt`:
```
groovy -e 'try { try { true; } finally { 1 / 0 } } catch (e) { println 
"caughtt" }'
```

But instead, it prints:
```
Caught: java.lang.ArithmeticException: Division by zero
java.lang.ArithmeticException: Division by zero
at script_from_command_line.run(script_from_command_line:1)
```

Why is the exception, thrown by the `finally`, not being caught by the outer 
try/catch?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (GROOVY-8048) final fields for pre-compiled traits aren't processed correctly

2017-02-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15858886#comment-15858886
 ] 

ASF GitHub Bot commented on GROOVY-8048:


Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/492


> final fields for pre-compiled traits aren't processed correctly
> ---
>
> Key: GROOVY-8048
> URL: https://issues.apache.org/jira/browse/GROOVY-8048
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.4.8
>Reporter: Paul King
>
> From slack:
> Testing 2.4.8 by running through the Grails tests (master branch) and seeing 
> NPE's on some tests that exercise Traits.  Can be fairly quickly replicated 
> by running `./gradlew :grails-plugin-interceptors:test`
> same tests pass in 2.4.7 up thru commit 
> https://github.com/apache/groovy/commit/c00a75a89a15e46c2afacf6e72256cd4484bd5f1
>   which causes the tests to fail with NPE's, don't have a lot of time to look 
> into it, just wanted to mention it
> the Trait class has a final property in it and when it's used it's null, 
> removing the final modifier gets rid of the problem 
> https://github.com/grails/grails-core/blob/master/grails-plugin-interceptors/src/main/groovy/grails/artefact/Interceptor.groovy#L113



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] groovy pull request #492: GROOVY-8048: final fields for pre-compiled traits ...

2017-02-08 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/492


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Updated] (GROOVY-8083) Fails to implement interface

2017-02-08 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8083:
---
Description: 
I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
 ), but AstNodeToScriptVisitor fails to implement the interface 
GroovyCodeVisitor. 

Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor( 
https://github.com/danielsun1106/groovy/commit/17c6bf12a096fda47d956035f84999c9666b14af
 ), but still failed to compile, so I have to provide a default implementation 
for visitLambdaExpression method...

Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
{code}
/home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
 85: Can't have an abstract method in a non-abstract class. The class 
'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be declared 
abstract or the method 'void 
visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
implemented.

 @ line 85, column 1.

   class AstNodeToScriptVisitor extends 
CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
GroovyClassVisitor {

   ^

1 error

 FAILED
{code}

  was:
I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
 ), but AstNodeToScriptVisitor fails to implement the interface 
GroovyCodeVisitor. 

Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor, but 
still failed to compile, so I have to provide a default implementation for 
visitLambdaExpression method...

Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
{code}
/home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
 85: Can't have an abstract method in a non-abstract class. The class 
'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be declared 
abstract or the method 'void 
visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
implemented.

 @ line 85, column 1.

   class AstNodeToScriptVisitor extends 
CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
GroovyClassVisitor {

   ^

1 error

 FAILED
{code}


> Fails to implement interface
> 
>
> Key: GROOVY-8083
> URL: https://issues.apache.org/jira/browse/GROOVY-8083
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 3.0
> Environment: java version "1.8.0_121"
>Reporter: Daniel Sun
>
> I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
> https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
>  ), but AstNodeToScriptVisitor fails to implement the interface 
> GroovyCodeVisitor. 
> Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor( 
> https://github.com/danielsun1106/groovy/commit/17c6bf12a096fda47d956035f84999c9666b14af
>  ), but still failed to compile, so I have to provide a default 
> implementation for visitLambdaExpression method...
> Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
> {code}
> /home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
>  85: Can't have an abstract method in a non-abstract class. The class 
> 'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be 
> declared abstract or the method 'void 
> visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
> implemented.
>  @ line 85, column 1.
>class AstNodeToScriptVisitor extends 
> CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
> GroovyClassVisitor {
>^
> 1 error
>  FAILED
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (GROOVY-8083) Fails to implement interface

2017-02-08 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8083:
---
Description: 
I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
 ), but AstNodeToScriptVisitor fails to implement the interface 
GroovyCodeVisitor. 

Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor, but 
still failed to compile, so I have to provide a default implementation for 
visitLambdaExpression method...

Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
{code}
/home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
 85: Can't have an abstract method in a non-abstract class. The class 
'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be declared 
abstract or the method 'void 
visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
implemented.

 @ line 85, column 1.

   class AstNodeToScriptVisitor extends 
CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
GroovyClassVisitor {

   ^

1 error

 FAILED
{code}

  was:
I tried to extend GroovyCodeVisitor to support visiting lambda expression, but 
AstNodeToScriptVisitor fails to implement the interface GroovyCodeVisitor. 

Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor, but 
still failed to compile, so I have to provide a default implementation for 
visitLambdaExpression method...

Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
{code}
/home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
 85: Can't have an abstract method in a non-abstract class. The class 
'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be declared 
abstract or the method 'void 
visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
implemented.

 @ line 85, column 1.

   class AstNodeToScriptVisitor extends 
CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
GroovyClassVisitor {

   ^

1 error

 FAILED
{code}


> Fails to implement interface
> 
>
> Key: GROOVY-8083
> URL: https://issues.apache.org/jira/browse/GROOVY-8083
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 3.0
> Environment: java version "1.8.0_121"
>Reporter: Daniel Sun
>
> I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
> https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
>  ), but AstNodeToScriptVisitor fails to implement the interface 
> GroovyCodeVisitor. 
> Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor, but 
> still failed to compile, so I have to provide a default implementation for 
> visitLambdaExpression method...
> Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
> {code}
> /home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
>  85: Can't have an abstract method in a non-abstract class. The class 
> 'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be 
> declared abstract or the method 'void 
> visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
> implemented.
>  @ line 85, column 1.
>class AstNodeToScriptVisitor extends 
> CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
> GroovyClassVisitor {
>^
> 1 error
>  FAILED
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (GROOVY-8083) Fails to implement interface

2017-02-08 Thread Daniel Sun (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857651#comment-15857651
 ] 

Daniel Sun commented on GROOVY-8083:


If all classes written in groovy, the issue does not exist. The following 
groovy script runs well:
{code}
class A {}
class B extends A {}

interface I {
void visitA(A a);
void visitB(B b);
}

class X implements I {
void visitA(A a) {}
void visitB(B b) {}
}

new X()
{code}

> Fails to implement interface
> 
>
> Key: GROOVY-8083
> URL: https://issues.apache.org/jira/browse/GROOVY-8083
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 3.0
> Environment: java version "1.8.0_121"
>Reporter: Daniel Sun
>
> I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
> https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
>  ), but AstNodeToScriptVisitor fails to implement the interface 
> GroovyCodeVisitor. 
> Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor( 
> https://github.com/danielsun1106/groovy/commit/17c6bf12a096fda47d956035f84999c9666b14af
>  ), but still failed to compile, so I have to provide a default 
> implementation for visitLambdaExpression method( 
> https://github.com/danielsun1106/groovy/commit/cfb3e50df5490a91099cfc8cf1b9f12a9d891108
>  )...
> Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
> {code}
> /home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
>  85: Can't have an abstract method in a non-abstract class. The class 
> 'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be 
> declared abstract or the method 'void 
> visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
> implemented.
>  @ line 85, column 1.
>class AstNodeToScriptVisitor extends 
> CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
> GroovyClassVisitor {
>^
> 1 error
>  FAILED
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (GROOVY-8083) Fails to implement interface

2017-02-08 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8083:
---
Description: 
I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
 ), but AstNodeToScriptVisitor fails to implement the interface 
GroovyCodeVisitor. 

Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor( 
https://github.com/danielsun1106/groovy/commit/17c6bf12a096fda47d956035f84999c9666b14af
 ), but still failed to compile, so I have to provide a default implementation 
for visitLambdaExpression method( 
https://github.com/danielsun1106/groovy/commit/cfb3e50df5490a91099cfc8cf1b9f12a9d891108
 )...

Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
{code}
/home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
 85: Can't have an abstract method in a non-abstract class. The class 
'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be declared 
abstract or the method 'void 
visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
implemented.

 @ line 85, column 1.

   class AstNodeToScriptVisitor extends 
CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
GroovyClassVisitor {

   ^

1 error

 FAILED
{code}

  was:
I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
 ), but AstNodeToScriptVisitor fails to implement the interface 
GroovyCodeVisitor. 

Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor( 
https://github.com/danielsun1106/groovy/commit/17c6bf12a096fda47d956035f84999c9666b14af
 ), but still failed to compile, so I have to provide a default implementation 
for visitLambdaExpression method...

Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
{code}
/home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
 85: Can't have an abstract method in a non-abstract class. The class 
'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be declared 
abstract or the method 'void 
visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
implemented.

 @ line 85, column 1.

   class AstNodeToScriptVisitor extends 
CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
GroovyClassVisitor {

   ^

1 error

 FAILED
{code}


> Fails to implement interface
> 
>
> Key: GROOVY-8083
> URL: https://issues.apache.org/jira/browse/GROOVY-8083
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 3.0
> Environment: java version "1.8.0_121"
>Reporter: Daniel Sun
>
> I tried to extend GroovyCodeVisitor to support visiting lambda expression( 
> https://github.com/danielsun1106/groovy/commit/609319ba60d6198e96028659461f080e58965aa6
>  ), but AstNodeToScriptVisitor fails to implement the interface 
> GroovyCodeVisitor. 
> Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor( 
> https://github.com/danielsun1106/groovy/commit/17c6bf12a096fda47d956035f84999c9666b14af
>  ), but still failed to compile, so I have to provide a default 
> implementation for visitLambdaExpression method( 
> https://github.com/danielsun1106/groovy/commit/cfb3e50df5490a91099cfc8cf1b9f12a9d891108
>  )...
> Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
> {code}
> /home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
>  85: Can't have an abstract method in a non-abstract class. The class 
> 'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be 
> declared abstract or the method 'void 
> visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
> implemented.
>  @ line 85, column 1.
>class AstNodeToScriptVisitor extends 
> CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
> GroovyClassVisitor {
>^
> 1 error
>  FAILED
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Updated] (GROOVY-8083) Fails to implement interface

2017-02-08 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8083:
---
Component/s: Compiler

> Fails to implement interface
> 
>
> Key: GROOVY-8083
> URL: https://issues.apache.org/jira/browse/GROOVY-8083
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 3.0
> Environment: java version "1.8.0_121"
>Reporter: Daniel Sun
>
> I tried to extend GroovyCodeVisitor to support visiting lambda expression, 
> but AstNodeToScriptVisitor fails to implement the interface 
> GroovyCodeVisitor. 
> Even if visitLambdaExpression is implemented by AstNodeToScriptVisitor, but 
> still failed to compile, so I have to provide a default implementation for 
> visitLambdaExpression method...
> Error messages( https://travis-ci.org/danielsun1106/groovy/builds/199517082 ):
> {code}
> /home/travis/build/danielsun1106/groovy/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/util/AstDumper.groovy:
>  85: Can't have an abstract method in a non-abstract class. The class 
> 'org.apache.groovy.parser.antlr4.util.AstNodeToScriptVisitor' must be 
> declared abstract or the method 'void 
> visitLambdaExpression(org.codehaus.groovy.ast.expr.LambdaExpression)' must be 
> implemented.
>  @ line 85, column 1.
>class AstNodeToScriptVisitor extends 
> CompilationUnit.PrimaryClassNodeOperation implements GroovyCodeVisitor, 
> GroovyClassVisitor {
>^
> 1 error
>  FAILED
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Created] (GROOVY-8084) Captured types doesn't work in @CompileStatic

2017-02-08 Thread Alexey Afanasiev (JIRA)
Alexey Afanasiev created GROOVY-8084:


 Summary: Captured types doesn't work in @CompileStatic
 Key: GROOVY-8084
 URL: https://issues.apache.org/jira/browse/GROOVY-8084
 Project: Groovy
  Issue Type: Bug
  Components: Static compilation, Static Type Checker
Affects Versions: 2.4.8
Reporter: Alexey Afanasiev


This code could be successfully compiled and executed. 
{code}
@CompileStatic
static def method(List captured) {
captured.add('some string')
return captured
}

println method(new ArrayList())
{code}

Looks like type check in groovy doesn't work with captured types. Is it a bug?

Is there any documentation about generics in groovy? 

P.S.:
Another kind of strange behaviour:
{code}
@CompileStatic
static def method() {
List list = new ArrayList<>()
List captured = list
captured.add('some string') //Error:(7, 5) Groovyc: [Static type checking] 
- Cannot call java.util.ArrayList #add(java.lang.Integer) 
with arguments [java.lang.String]
return captured
}
{code}
Somehow type checking infered type of 'captured' variable to  
java.util.ArrayList  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (GROOVY-5728) Accessing private constructor from a static factory

2017-02-08 Thread JIRA

[ 
https://issues.apache.org/jira/browse/GROOVY-5728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857927#comment-15857927
 ] 

Peter Myrén commented on GROOVY-5728:
-

Same problem with non anonymous inner class.

It woks with protected constructor though.
{code}
public abstract class FooMain {
protected FooMain() {}
public abstract String bar();
public static FooMain factory() {
  return new FooMain() {
public String bar() { return "xxx"; }
  };
}
public static void main(String[] args) {
System.out.println(factory().bar());
}   
}
{code}

Tested with groovy 2.4.8

> Accessing private constructor from a static factory
> ---
>
> Key: GROOVY-5728
> URL: https://issues.apache.org/jira/browse/GROOVY-5728
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.0.4, 2.4.0-beta-3
>Reporter: Paul King
>Priority: Minor
>
> The following code works fine from Java but fails in Groovy:
> {code}
> public abstract class FooMain {
> private FooMain() {}
> public abstract String bar();
> public static FooMain factory() {
>   return new FooMain() {
> public String bar() { return "xxx"; }
>   };
> }
> public static void main(String[] args) {
> System.out.println(factory().bar());
> }
> }
> // => java.lang.IllegalAccessError: tried to access method FooMain.()V 
> from class FooMain$1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (GROOVY-8082) Groovy sql.rows returns org.postgresql.util.PSQLException: No hstore extension installed

2017-02-08 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857954#comment-15857954
 ] 

Paul King edited comment on GROOVY-8082 at 2/8/17 1:02 PM:
---

The Sql api doesn't have a {{rows(String, Map)}} variant. Do any of these work:
{code}
groovySql.rows(sql, *params)
groovySql.rows(params, sql)
groovySql.rows(sql, [params])
{code}


was (Author: paulk):
The Sql api doesn't have a rows(String, Map) variant. Do any of these work:
{code}
groovySql.rows(sql, *params)
groovySql.rows(params, sql)
groovySql.rows(sql, [params])
{code}

> Groovy sql.rows returns org.postgresql.util.PSQLException: No hstore 
> extension installed
> 
>
> Key: GROOVY-8082
> URL: https://issues.apache.org/jira/browse/GROOVY-8082
> Project: Groovy
>  Issue Type: Bug
>  Components: SQL processing
>Affects Versions: 2.4.4
>Reporter: Clessio Cunha Mendes
>Priority: Minor
>
> -> Steps to Reproduce
> 1) create a simple sql string with no where clause
> 2) pass an empty Map [:] as params to groovySql.rows(sql, params)
> PS: (as workargound, passing an empty List, instead of an empty map, as 
> params behaves like expected)
> -> Expected Behaviour
> call postgres and run the sql passing no parameters
> -> Actual Behaviour
> Exception raised: No hstore extension installed.. Stacktrace follows:
> org.postgresql.util.PSQLException: No hstore extension installed.
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.setMap(AbstractJdbc2Statement.java:1707)
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1910)
> at 
> org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:36)
> at 
> org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:47)
> -> Environment Information
> Operating System: Windows
> Grails Version: 2.5.4
> JDK Version: 1.7
> Container Version (If Applicable): N/A
> Database: Postgres 9.3.13
> -> Probable fix
> Method singletonList(Object item) at groovy.sql.SQL
> -> More information
> http://stackoverflow.com/q/39245870/1916198



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (GROOVY-8082) Groovy sql.rows returns org.postgresql.util.PSQLException: No hstore extension installed

2017-02-08 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857954#comment-15857954
 ] 

Paul King edited comment on GROOVY-8082 at 2/8/17 1:21 PM:
---

The Sql api doesn't have a {{rows(String, Map)}} variant. Do any of these work:
{code}
groovySql.rows(sql, *:params)
groovySql.rows(params, sql)
groovySql.rows(sql, [params])
{code}
Actually, I just tried them and there doesn't seem to be a useful workaround 
apart from the empty list as you suggest or perhaps more intuitively:
{code}
def result = params ? groovySql.rows(sql, params) : groovySql.rows(sql)
{code}


was (Author: paulk):
The Sql api doesn't have a {{rows(String, Map)}} variant. Do any of these work:
{code}
groovySql.rows(sql, *:params)
groovySql.rows(params, sql)
groovySql.rows(sql, [params])
{code}

> Groovy sql.rows returns org.postgresql.util.PSQLException: No hstore 
> extension installed
> 
>
> Key: GROOVY-8082
> URL: https://issues.apache.org/jira/browse/GROOVY-8082
> Project: Groovy
>  Issue Type: Bug
>  Components: SQL processing
>Affects Versions: 2.4.4
>Reporter: Clessio Cunha Mendes
>Priority: Minor
>
> -> Steps to Reproduce
> 1) create a simple sql string with no where clause
> 2) pass an empty Map [:] as params to groovySql.rows(sql, params)
> PS: (as workargound, passing an empty List, instead of an empty map, as 
> params behaves like expected)
> -> Expected Behaviour
> call postgres and run the sql passing no parameters
> -> Actual Behaviour
> Exception raised: No hstore extension installed.. Stacktrace follows:
> org.postgresql.util.PSQLException: No hstore extension installed.
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.setMap(AbstractJdbc2Statement.java:1707)
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1910)
> at 
> org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:36)
> at 
> org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:47)
> -> Environment Information
> Operating System: Windows
> Grails Version: 2.5.4
> JDK Version: 1.7
> Container Version (If Applicable): N/A
> Database: Postgres 9.3.13
> -> Probable fix
> Method singletonList(Object item) at groovy.sql.SQL
> -> More information
> http://stackoverflow.com/q/39245870/1916198



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (GROOVY-8082) Groovy sql.rows returns org.postgresql.util.PSQLException: No hstore extension installed

2017-02-08 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857954#comment-15857954
 ] 

Paul King edited comment on GROOVY-8082 at 2/8/17 1:02 PM:
---

The Sql api doesn't have a {{rows(String, Map)}} variant. Do any of these work:
{code}
groovySql.rows(sql, *:params)
groovySql.rows(params, sql)
groovySql.rows(sql, [params])
{code}


was (Author: paulk):
The Sql api doesn't have a {{rows(String, Map)}} variant. Do any of these work:
{code}
groovySql.rows(sql, *params)
groovySql.rows(params, sql)
groovySql.rows(sql, [params])
{code}

> Groovy sql.rows returns org.postgresql.util.PSQLException: No hstore 
> extension installed
> 
>
> Key: GROOVY-8082
> URL: https://issues.apache.org/jira/browse/GROOVY-8082
> Project: Groovy
>  Issue Type: Bug
>  Components: SQL processing
>Affects Versions: 2.4.4
>Reporter: Clessio Cunha Mendes
>Priority: Minor
>
> -> Steps to Reproduce
> 1) create a simple sql string with no where clause
> 2) pass an empty Map [:] as params to groovySql.rows(sql, params)
> PS: (as workargound, passing an empty List, instead of an empty map, as 
> params behaves like expected)
> -> Expected Behaviour
> call postgres and run the sql passing no parameters
> -> Actual Behaviour
> Exception raised: No hstore extension installed.. Stacktrace follows:
> org.postgresql.util.PSQLException: No hstore extension installed.
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.setMap(AbstractJdbc2Statement.java:1707)
> at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1910)
> at 
> org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:36)
> at 
> org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:47)
> -> Environment Information
> Operating System: Windows
> Grails Version: 2.5.4
> JDK Version: 1.7
> Container Version (If Applicable): N/A
> Database: Postgres 9.3.13
> -> Probable fix
> Method singletonList(Object item) at groovy.sql.SQL
> -> More information
> http://stackoverflow.com/q/39245870/1916198



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)