Classes in Anonymous Code

Issue #988 duplicate
Derek Wiers created an issue

I'm pretty sure I had a related ticket earlier for this, but I think at some point IC2 might have had a regression. I don't do this very often, so I couldn't say when, but I just started using a class in an anonymous block earlier today. The results were...interesting. If I put the class definition on top, the class gets evaluated, color-coded, highlighted, inspected, etc as expected, but the code below the class, outside of it - IC is very confused by it. Vice-versa, if I define the class at the bottom of the anonymous code, then the non-class code is highlighted and the class itself shows all sorts of errors and IC doesn't know what to do with it. The code itself compiles.

class Foo {
    public String bar; // just fine

Foo thing = new Foo(); = 'Test'; // none of this code is highlighted, but it runs just fine
Foo thing = new Foo(); = 'Test'; // This code is highlighted, but Foo is not recognized by inspections since the class is not parsed below

class Foo {
    public String bar;

Comments (1)

  1. Log in to comment