Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have a similar problem that I'm trying to work through.</p> <p>I have found two situations where I know this occurs and have found a way around one of them.</p> <p>Scenario 1) You class refers to a class on the classpath further up the chain than the one also found in the jar, however in the import statement the import statement is of the form </p> <pre><code>import com.company.classes.to.use.* </code></pre> <p>By bulking them up, the IDE seems to pick up all classes in that package from the same jar location. By splitting them out into individual import class statements the IDE will pick them up separately.</p> <p>Scenario 2) You class daisy chains methods for the overridden class.</p> <pre><code>something.getSomethingElse().getAnotherThing().getYetAnotherThing(); </code></pre> <p>if getSomethingElse() returns an object that isn't otherwise in the class (so you dont have to import it) then you still get the error. (Adding the import greys the line as it recognises it isn't used so it doesn't help). I wouldn't condone this method anyway.</p> <p>edit: Obvious alternative to this is to refactor the code to break the line down to </p> <pre><code>ObjectToImport obj = something.getSomethingElse(); result = obj.getAnotherThing.getYetAnotherThing(); </code></pre> <p>And then import the temp variable...</p> <p><strong>Obviously</strong> this isn't ideal, and you shouldn't be refactoring your code for the sake of your IDE, but needs must, those red lines annoy the hell out of me.</p> <p>I hope these help. If you have found a better solution please share!</p> <p>Regards, M</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload