[jira] [Created] (GROOVY-9562) Base class property causes CCE

2020-05-18 Thread Daniil Ovchinnikov (Jira)
Daniil Ovchinnikov created GROOVY-9562:
--

 Summary: Base class property causes CCE
 Key: GROOVY-9562
 URL: https://issues.apache.org/jira/browse/GROOVY-9562
 Project: Groovy
  Issue Type: Bug
  Components: Static compilation
Affects Versions: 2.5.11
Reporter: Daniil Ovchinnikov


{code:title=playground.groovy}
abstract class BaseClass {
def prop = 42
}

abstract class BaseClass2 {
def prop = 69
}

@groovy.transform.CompileStatic
class Impl extends BaseClass {
def usage() {
new BaseClass2() {
def foo() {
prop
}
}
}
}

assert new Impl().usage().foo() == 69
{code}

Output:
{noformat}
Caught: java.lang.ClassCastException: Impl$1 cannot be cast to BaseClass
java.lang.ClassCastException: Impl$1 cannot be cast to BaseClass
at Impl$1.foo(playground.groovy)
at Impl$1$foo.call(Unknown Source)
at playground.run(playground.groovy:20)
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (GROOVY-9561) Some ternary expressions with []'s and 'as' are not parsed properly

2020-05-18 Thread OC (Jira)
OC created GROOVY-9561:
--

 Summary: Some ternary expressions with []'s and 'as' are not 
parsed properly
 Key: GROOVY-9561
 URL: https://issues.apache.org/jira/browse/GROOVY-9561
 Project: Groovy
  Issue Type: Bug
  Components: parser
Affects Versions: 3.0.3
Reporter: OC


Expressions of type “1>2?[3] as Set:null” are not parsed properly, example 
below. I haven't tried all the versions, but I believe it is a problem caused 
by the parrot; I've checked 2.4.17 and 2.5.8 and both worked properly.

There's a very plain work-around, it suffices to enclose the middle part of the 
expression in parentheses, like “1>2?([3] as Set):null”. Besides, such 
expressions are pretty rare.

Far as I understand, the ambiguity of “as” and safe indexing both play their 
part and it might prove difficult to fix without forbidding “as” usage as 
identifier, which would break old code in a considerably worse way than this.

For all these reasons I believe the trivial priority in this case is better 
than minor, which would technically fit the problem better.

 
{code:java}
52 ocs /tmp> >q.groovy                           
1>2?[3] as Set:null
53 ocs /tmp> /usr/local/groovy-3.0.3/bin/groovy q
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/private/tmp/q.groovy: 1: Unexpected input: '1>2?[3]' @ line 1, column 1.
   1>2?[3] as Set:null
   ^
1 error
54 ocs /tmp> 
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [groovy] paulk-asert commented on pull request #1214: Add hyperlink to refactoring with VsCode

2020-05-18 Thread GitBox


paulk-asert commented on pull request #1214:
URL: https://github.com/apache/groovy/pull/1214#issuecomment-630075143


   Merged, thanks. Release planned soon.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [groovy] asfgit closed pull request #1214: Add hyperlink to refactoring with VsCode

2020-05-18 Thread GitBox


asfgit closed pull request #1214:
URL: https://github.com/apache/groovy/pull/1214


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org