You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Allen Arakaki (JIRA)" <ji...@apache.org> on 2015/05/29 09:33:18 UTC
[jira] [Updated] (GROOVY-7439) Compilation errors using groovy
trait and @CompileStatic and @Slf4j("LOG")
[ https://issues.apache.org/jira/browse/GROOVY-7439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Allen Arakaki updated GROOVY-7439:
----------------------------------
Description:
```
import org.slf4j.Logger
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
@Slf4j("LOG")
@CompileStatic
trait TTest {
void test1() {
LOG.debug("Logging test1 ...")
}
void test2() {
//((Logger)LOG).debug("Logging test2 ...")
}
}
```
Results in the following:
| Error Compilation error: startup failed:
..\src\groovy\TTest.groovy: 10: [Static type checking] - Cannot find matching method java.lang.Object#debug(java.lang.String). Please check if the declared type is right and if the method exists.
@ line 10, column 5.
LOG.debug("Logging test1 ...")
^
```
import org.slf4j.Logger
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
@Slf4j("LOG")
@CompileStatic
trait TTest {
void test1() {
//LOG.debug("Logging test1 ...")
}
void test2() {
((Logger)LOG).debug("Logging test2 ...")
}
}
```
Results in the following error:
| Error Compilation error: startup failed:
..\src\groovy\TTest.groovy: -1: Access to TTest#LOG is forbidden @ line -1, column -1.
was:
```
import org.slf4j.Logger
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
@Slf4j("LOG")
@CompileStatic
trait TTest {
void test1() {
LOG.debug("Logging test1 ...")
}
void test2() {
//((Logger)LOG).debug("Logging test2 ...")
}
}
```
Results in the following:
| Error Compilation error: startup failed:
..\src\groovy\TTest.groovy: 10: [Static type checking] - Cannot find matching method java.lang.Object#debug(java.lang.String). Please check if the declared type is right and if the method exists.
@ line 10, column 5.
LOG.debug("Logging test1 ...")
^
```
import org.slf4j.Logger
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
@Slf4j("LOG")
@CompileStatic
trait TTest {
void test1() {
//LOG.debug("Logging test1 ...")
}
void test2() {
((Logger)LOG).debug("Logging test2 ...")
}
}
```
Results in the following error:
| Error Compilation error: startup failed:
..\src\groovy\TTest.groovy: -1: Access to TTest#LOG is forbidden @ line -1, column -1.
> Compilation errors using groovy trait and @CompileStatic and @Slf4j("LOG")
> --------------------------------------------------------------------------
>
> Key: GROOVY-7439
> URL: https://issues.apache.org/jira/browse/GROOVY-7439
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.4.3
> Environment: Windows 8.1
> Oracle JDK 8.u45
> Reporter: Allen Arakaki
>
> ```
> import org.slf4j.Logger
> import groovy.transform.CompileStatic
> import groovy.util.logging.Slf4j
> @Slf4j("LOG")
> @CompileStatic
> trait TTest {
> void test1() {
> LOG.debug("Logging test1 ...")
> }
> void test2() {
> //((Logger)LOG).debug("Logging test2 ...")
> }
> }
> ```
> Results in the following:
> | Error Compilation error: startup failed:
> ..\src\groovy\TTest.groovy: 10: [Static type checking] - Cannot find matching method java.lang.Object#debug(java.lang.String). Please check if the declared type is right and if the method exists.
> @ line 10, column 5.
> LOG.debug("Logging test1 ...")
> ^
> ```
> import org.slf4j.Logger
> import groovy.transform.CompileStatic
> import groovy.util.logging.Slf4j
> @Slf4j("LOG")
> @CompileStatic
> trait TTest {
> void test1() {
> //LOG.debug("Logging test1 ...")
> }
> void test2() {
> ((Logger)LOG).debug("Logging test2 ...")
> }
> }
> ```
> Results in the following error:
> | Error Compilation error: startup failed:
> ..\src\groovy\TTest.groovy: -1: Access to TTest#LOG is forbidden @ line -1, column -1.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)