我想在Intellij终端中使用git,但它无法识别命令.在命令提示符和Windows power shell中,命令被识别(我在系统环境变量中添加了git路径).我也知道Intellij有一个与Git的GUI集成.
那么,任何人都可以告诉我如何在Intellij终端中使用git命令.
我有一个常见的CurrencyTypes示例列表
class CurrencyType
{
int id;
def code;
def currency;
CurrencyType(int _id, String _code, String _currency)
{
id = _id
code = _code
currency = _currency
}
}
def currenciesList = new ArrayList<CurrencyType>()
currenciesList.add(new CurrencyType(1,"INR", "Indian Rupee"))
currenciesList.add(new CurrencyType(1,"USD", "US Dollar"))
currenciesList.add(new CurrencyType(1,"CAD", "Canadian Dollar"))
Run Code Online (Sandbox Code Playgroud)
我希望代码列表以逗号分隔的值(如INR,USD,CAD)和最少的代码以及创建新列表.
我想查看从我自己的源代码生成的代码,但似乎IDEA没有使用IntelliJ API Decompiler使用新的fernflower插件对它们进行反编译.
至少我有标题评论
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
Run Code Online (Sandbox Code Playgroud)
和那样的方法: public void update() { /* compiled code */ }
同时,在外部库(例如JDK)中,我看到了正常的头文件和反编译代码.
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
Run Code Online (Sandbox Code Playgroud)
我可以使反编译工作,如果我将代码编译为jar并将其添加到某个模块,但它看起来不像一个普通的解决方案.
我可以使用fernflower使IDEA反编译任何类文件吗?
编辑:打开文件时,我在IDEA日志文件中得到一个异常.请参阅片段.
<pre>
2015-02-13 19:16:29,991 [119281666] WARN - l.compiled.ClassFileDecompiler - decompiler: class org.jetbrains.java.decompiler.IdeaDecompiler
com.intellij.psi.compiled.ClassFileDecompilers$Light$CannotDecompileException: org.jetbrains.java.decompiler.IdeaLogger$InternalException: Method <init> (Ljava/util/HashMap;)V couldn't be decompiled.
at org.jetbrains.java.decompiler.IdeaDecompiler.getText(IdeaDecompiler.java:162)
at com.intellij.psi.impl.compiled.ClassFileDecompiler.decompile(ClassFileDecompiler.java:57) …Run Code Online (Sandbox Code Playgroud)我有点惊讶,因为我之前读过,该__gc元方法仅针对用户数据调用,而从不针对表调用。(LuaFAQ:为什么 __gc 和 __len 元方法不能在表上工作?)
但是最近我尝试了一下,发现确实有效!在 Lua 5.2.1 上尝试以下代码:
do
local b = setmetatable({a = 1}, {__gc = function(self) print(self.a); end});
end
collectgarbage();
Run Code Online (Sandbox Code Playgroud)
但我在任何地方都找不到这方面的变更日志,所以我有点沮丧并且不敢使用它。
也许,有人可以证明我的建议?或者这是一种无证行为?对于我来说,有一个常规的方法来创建表析构函数会很好,如果我的观察是正确的,我会很高兴。
我想知道是否有什么东西可以给我类似于 Groovy 的 nice power assert 语句的结果。
> assert ["1", '2']*.size() == [2, 3]
Result: Assertion failed:
assert ["1", '2']*.size() == [2, 3]
| |
[1, 1] false
Run Code Online (Sandbox Code Playgroud)
AFAIKscalatest我目前使用的语言和
. 但也许有人可以建议一些辅助图书馆这样做?这是一个宠物项目,所以实验性的和没有得到很好支持的库是可以的。
编辑:我知道匹配器(scalatest 的,甚至是普通的 java hamcrest 匹配器)。我发现他们写起来很冗长,而且他们的输出缺乏细节。
上面的示例显示了中间计算步骤,有助于检测错误。它向您展示了经过测试的代码有什么问题,并提供了更多详细信息。
我希望,引入这种行为需要在运行时获得有关表达式 AST 的信息。但我想,这些信息可以通过使用宏来“烘焙”编译时间。
即,如果我们有表达式assert a + b == cscala(或我正在寻找的一些宏扩展)可以将其重写为:
if (!(a + b == c)) {
// detailed message is
// compute a
// compute b
// compute a + b
// compute c
// compute a + …Run Code Online (Sandbox Code Playgroud)