The type 'List' is declared with 0 type parameters, but 1 type arguments were given
时间: 2024-05-04 15:20:38 浏览: 277
This error message typically occurs when you try to pass type arguments to a generic type that does not expect any.
For example, if you have a class or method that uses the generic type `List`, but you mistakenly specify a type parameter when creating an instance of the list, you will get this error.
Here's an example:
```
List<string> myList = new List<string>(); // This is correct because List<T> expects a type parameter
List myOtherList = new List<string>(); // This will result in the error message you mentioned because List does not expect a type parameter
```
To fix this error, make sure you are not passing any type arguments to a generic type that does not expect any.
相关问题
Parameter "decodeTime" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
这个问题看起来是在使用某个程序时出现了一个警告,警告内容为“Parameter 'decodeTime' is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.”,大致意思是注入参数到信号处理程序中已经过时,应该使用带有形式参数的 JavaScript 函数代替。
这个问题通常是由代码中使用了不推荐的信号处理程序语法导致的。你可以通过使用带有形式参数的 JavaScript 函数来解决这个问题。例如,将原来的信号处理程序:
```
function onDecodeFinished(decodeTime) {
// 处理解码完成事件
}
```
改为:
```
function onDecodeFinished() {
var decodeTime = arguments[0];
// 处理解码完成事件
}
```
这样就可以避免使用不推荐的信号处理程序语法,同时也可以正常处理解码完成事件。
Optional int parameter 'type' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type
这个错误提示是因为你在方法参数中定义了一个类型为int的可选参数type,但是你没有给它赋默认值,也就是说当这个参数没有被传入时,它的值会是0,而0又不能被赋给Integer对象。解决方法是将参数类型从int改为Integer,这样就可以将null赋给它了。例如:
```
public void myMethod(String name, Integer type) {
// do something
}
```
阅读全文