简体   繁体   English

具有“无法访问”错误的奇怪Java变量类型,但在可编译代码中

[英]Strange Java variable type with “cannot access” error, but in compilable code

While coding, I have ran into a type that "behaves" neither like a primitive nor Object in my NetBeans IDE. 在编码时,我遇到了一种类型,在我的NetBeans IDE中既不像原语也不像对象。 The type is IoBuffer from Apache MINA (but propabably the exact type has nothing to this question). 类型是来自Apache MINA的 IoBuffer(但可能确切的类型对此问题没有任何意义)。

From my perspective: 依我看来:

  • my project compiles well, despite that this type is used in lot places underneath 我的项目编译得很好,尽管这种类型用于下面的很多地方
  • my NetBeans don't recognize this type ( "cannot find symbol" hint when i wrote IoBuffer ) 我的NetBeans不识别这种类型(当我写IoBuffer"cannot find symbol"提示)
  • I can't create IoBuffer variable/instance ( compile error: "cannot find symbol" ) 我无法创建IoBuffer变量/实例( compile error: "cannot find symbol"
  • I can't invoke any method on that type, like toString . 我不能调用该类型的任何方法,如toString

Of course, this is a standard Java class, but it looks unusual from current perspective (Maven project of one of examples bundled with Red5 Media Server) 当然,这是一个标准的Java类,但从当前的角度来看它看起来很不寻常(与Red5 Media Server捆绑在一起的一个示例的Maven项目)

Simple invocation: 简单的调用:

// videoData.getData() returns IoBuffer
videoData.getData().toString()

Causes hint & compile-time error: 导致提示和编译时错误:

org/red5/demos/oflaDemo/StreamMultiplexer.java:[89,30] error: cannot access IoBuffer

Same error if I write only videoData.getData() - hint in this case is The type od getData() is erroneous 如果我只写videoData.getData()出现同样的错误 - 在这种情况下的提示是The type od getData() is erroneous

What caused this situation? 是什么造成了这种情况

Have you tried clearing netbeans cache? 你有没有尝试清除netbeans缓存? To clear cache: Shutdown Netbeans, rename %AppData%\\Local\\NetBeans\\Cache\\7.2\\index, restart, wait for background scanning to complete and try again... 要清除缓存:关闭Netbeans,重命名%AppData%\\ Local \\ NetBeans \\ Cache \\ 7.2 \\ index,重新启动,等待后台扫描完成,然后重试......

Apologies if my answer isn't specific enough. 如果我的答案不够具体,请道歉。 If you can provide some more code, that may help. 如果您可以提供更多代码,那可能会有所帮助。

I believe the best way is to recreate that particular project and re-import the dependencies. 我相信最好的方法是重新创建该特定项目并重新导入依赖项。 There's a number of people with seemingly similar errors: http://forum.ragezone.com/f566/netbeans-compile-error-713536/ http://www.moparscape.org/smf/index.php?topic=645055.0 有很多人看似相似的错误: http//forum.ragezone.com/f566/netbeans-compile-error-713536/ http://www.moparscape.org/smf/index.php?topic=645055.0

If that doesn't work, try: 如果这不起作用,请尝试:

Let me know if it helps. 如果有帮助,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM