防止 Java/IntelliJ 中的重复类错误
我正在编写一个解释器(Crafting Interpreters),并且我想保留该解释器的工作状态同一根文件夹中每章之后的解释器。
解释器的名称是 jlox,为了在第 7 章之后保留其状态,我想将 jlox 目录中的代码复制到 jlox[7] 目录中。参见图片。
,随后,我将复制到 jlox[Y] 目录,其中 Y = 要保留的章节。
像这样复制的问题是 IntelliJ 将所有类视为重复项,从而阻止构建任何代码。有没有一种方法/设置可以避免重复类错误,并增加能够在同一文件夹中维护代码库重复项的约束?
I'm writing an interpreter (w. Crafting Interpreters), and I'd like to preserve the working state of the interpreter after each chapter in the same root folder.
The interpreter's name is jlox, and to preserve its state after chapter 7, I want to duplicate the code in the jlox dir into a jlox[7] dir. See image.
So, subsequently, I'll duplicate into jlox[Y] dir, where Y = chapter to preserve.
The problem with copying like this is that IntelliJ sees all the classes as duplicates, preventing any code from building. Is there a way/setting to avoid a duplicate class
error with the added constraint of being able to maintain duplicates of the code base in the same folder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我尝试了一些方法,这有效:使根目录下的每个目录成为一个模块。
您会注意到,在第一张图片(上图)中,
jlox
不是模块,但jlox[7]
是。因此解决方案是将 jlox 也设为一个模块。I tried a few things and this worked: making every dir under root a module.
You'll notice in first image (above) that
jlox
is not a module, butjlox[7]
is. So the fix was to makejlox
a module as well.