我遇到了使用泛型方法的麻烦
编译类:
public class Something<T> {
public static Something newInstance(Class<T> type){};
public <T> void doSomething(T input){};
}
Run Code Online (Sandbox Code Playgroud)
我的方法是:
public <S> void doOtherThing(S input){
Something smt = Something.newInstance(input.getClass());
smt.doSomething(input); // Error here
}
Run Code Online (Sandbox Code Playgroud)
它在编译时遇到错误:
没有找到适合doSomething(T)的方法T不能转换为捕获#1的?扩展java.lang.Object ...
我想可能有一个窍门可以避免这种情况,请帮助
我想在构建一个spring引导应用程序后修改jar文件的application.properties.我曾经习惯jar xf提取jar文件,然后修改了属性文件但是在jar-ed(jar -0cf)之后,它还没有使用printout:
<filename> .jar中没有主要清单属性
那么无论如何要做到这一点以及如何做?