Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized method call with @CompileDynamic #1100

Closed
mauromol opened this issue Apr 24, 2020 · 2 comments
Closed

Unrecognized method call with @CompileDynamic #1100

mauromol opened this issue Apr 24, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@mauromol
Copy link

mauromol commented Apr 24, 2020

Consider this Groovy class:

package test65

import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic

@CompileStatic
class Test65 {

	@CompileDynamic
	static enum ShippingAddressSynchType {
		ACCOUNTING {
			@Override
			void synch(Test65 customer) {
				foo('foo')
			}
			
			private foo(String foo) { }
		};

		void synch(Test65 customer) { }

		private String truncate(String input, int maxLength) {
			if(!input)
				return input
			if(input.length() > maxLength)
				input = input[0..maxLength - 1]
			return input
		}
	}
}

The call to foo(String) is underlined and navigation to it does not work. If you remove @CompileDynamic both syntax highlighting and navigation work fine.

image

@eric-milles eric-milles self-assigned this Apr 24, 2020
@eric-milles eric-milles added this to the v3.8.0 milestone Apr 24, 2020
eric-milles added a commit that referenced this issue Apr 24, 2020
enum E {
  X { // block for anon. inner
    def m() {
      n() // implicit-this type is E$1
    }
    private def n() {}
  }
}
@eric-milles
Copy link
Member

eric-milles commented Apr 24, 2020

ready to test

image

Do these enum constant inner classes support fields and types as well? Only methods are visited for type info.

@mauromol
Copy link
Author

Works with 3.8.0.v202004242058-e1912.

Yes, of course, just like any top-level enum, a nested enum may itself also contain fields and inner/nested classes. I use them regularly, although usually in Java code, as enums declared in Groovy have always been problematic...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants