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

"Cannot find symbol" #551

Open
swarnendubiswas opened this issue Jun 3, 2018 · 7 comments
Open

"Cannot find symbol" #551

swarnendubiswas opened this issue Jun 3, 2018 · 7 comments

Comments

@swarnendubiswas
Copy link

VS Code shows a "Cannot find symbol" error with the red squigly for several symbols but "Go to definition" works which means the definition is available.

Environment
  • Operating System: Ubuntu 18.04
  • JDK version: 1.8.0_171
  • Visual Studio Code version: 1.23.1
  • Java extension version: 0.26.0
Steps To Reproduce
  1. Open the attached dummy project in VS Code.
Current Result

You should see several errors related to "cannot find symbol". However, navigation or "Go to definition" works on these symbols.

Expected Result

The red squiggly lines should not appear since I think the symbols are indeed available.

Additional Informations

The VS Code settings.json file is also attached.
java-symbols.zip

@fbricon
Copy link
Collaborator

fbricon commented Jun 7, 2018

Indeed, for some reason LineAddress can't be resolved immediately. but as soon as IntegerVariantTypes.java is opened, the compilation errors disappear. Might be caused by LineAddress being an inner class in a file that's doesn't define the IntegerVariantTypes class. Same project opens fine in Eclipse.

@fbricon fbricon added the bug label Jun 7, 2018
@alejandrosaucedo
Copy link

I have the same problem.

What is the solution?

@neesonqk
Copy link

neesonqk commented Jan 21, 2019

I got this similar problem after I disable and enable Maven Plugin, before that everything worked like a charm, firstly I disabled Maven plugin, and restarted, then I started to see those annoying errors, I then re-enabled maven plugin, unlucky, those errors are still there, unable to eliminate no matter what I do. But my code runs without any problem.

@yaohaizh
Copy link
Collaborator

@neesonqk Those errors because of the inner classes. Could you call "Java: Force Java Compilation" to see whether your issue persists.

@neesonqk
Copy link

neesonqk commented Jan 21, 2019

@yaohaizh the issue still persists.

image

image

@neesonqk
Copy link

My bad, my problem is that, I incidentally installed java linter extension when I disable Maven Plugin...

By uninstalling java linter I am able to eliminate those annoying errors.

@ghost
Copy link

ghost commented Jan 7, 2021

@neesonqk Those errors because of the inner classes. Could you call "Java: Force Java Compilation" to see whether your issue persists.

hey, when i try doing mine, it just says a variable is not used. But it should still be working like charm. I'm trying to make my discord bot online with discord jda. Could you maybe review my code? here

my code :

package hoppity.Hops;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;

public class Patootie {
public static void main(String[] args) throws Exception {
JDA jda = JDABuilder.createDefault("Nzk2ODc0NTU3MjQzOTE2MzQ4.X_eRQw.ALNht8H0ZdCSRYN46rPpoigzMvs").build();

}

}

console log :

Patootie.java:3: error: package net.dv8tion.jda.api does not exist
import net.dv8tion.jda.api.JDA;
^
Patootie.java:4: error: package net.dv8tion.jda.api does not exist
import net.dv8tion.jda.api.JDABuilder;
^
Patootie.java:8: error: cannot find symbol
JDA jda = JDABuilder.createDefault("Nzk2ODc0NTU3MjQzOTE2MzQ4.X_eRQw.ALNht8H0ZdCSRYN46rPpoigzMvs").build();
^
symbol: class JDA
location: class Patootie
Patootie.java:8: error: cannot find symbol
JDA jda = JDABuilder.createDefault("Nzk2ODc0NTU3MjQzOTE2MzQ4.X_eRQw.ALNht8H0ZdCSRYN46rPpoigzMvs").build();
^
symbol: variable JDABuilder
location: class Patootie
4 errors

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

No branches or pull requests

6 participants