所以问题是能够结合多个警告抑制,以便每个项目不需要它自己的@SuppressWarnings注释.
例如:
public class Example
public Example() {
GO go = new GO(); // unused
....
List<String> list = ( List<String> ) go.getList(); // unchecked
}
...
// getters/setters/other methods
}
Run Code Online (Sandbox Code Playgroud)
现在@SuppressWarnings我没有两个警告,而是在课堂上有两个警告,所以这样:
@SuppressWarnings( "unused", "unchecked" )
public class Example
public Example() {
GO go = new GO(); // unused - suppressed
....
List<String> list = ( List<String> ) go.getList(); // unchecked - suppressed
}
...
// getters/setters/other methods
}
Run Code Online (Sandbox Code Playgroud)
但这不是一个有效的语法,有没有办法做到这一点?
这段代码也引用了什么?
queryString: function() {
//some code
}
Run Code Online (Sandbox Code Playgroud)
我在WebConsole(Firefox)中对它进行了测试,但它不会执行,因此我认为它不等同于function queryString() {}.
那究竟是什么?
用Web开发技术编写的Metro应用程序和用XAML/C#编写的应用程序有什么区别?Microsoft Metro API是否为Javascript提供了挂钩,它是C#的原生内容?他们应该携手合作,还是开发商选择走哪条路?
如果使用JS(OpenGL硬件功能除外),是否存在某些无法实现的功能?
我想知道的原因是要知道哪些技术是构建大量Metro应用程序所必需的,所以当我到达某一点时,我不会被一堵砖墙挡住,让我知道我使用了错误的技术.
我有以下gulpfile
我正在使用emberate,它会在生成的文件(client/.index.js在本例中)被写入时调用回调.现在browserify任务取决于该文件,所以它不应该在嵌入完成之后运行.但是我得到了不同的结果,有时它会起作用,有时我会得到这个:
错误:无法从'/ Users/myuser/workspace/myproject'中找到模块'./client/.index.js'
来自browserify(是的,文件还没有)..我不确定我做错了什么,我done在我的emberate任务中作为回调,而浏览器任务取决于emberate ..我错过了什么?
编辑:发现一个小模式,如果我运行它并没有错误,下次我运行时gulp我得到错误,但下次我没有,所以它是每隔一次oO
如果我跑gulp emberate,那很有效.然后,如果我运行gulp browserify它运行以下:
[gulp] Using file /Users/myuser/workspace/myproject/gulpfile.js
[gulp] Working directory changed to /Users/myuser/workspace/myproject
[gulp] Running 'clean'...
[gulp] Finished 'clean' in 3.11 ms
[gulp] Running 'emberate'...
[gulp] Finished 'emberate' in 22 ms
[gulp] Running 'browserify'...
[gulp] Live reload server listening on: 35729
events.js:72
throw er; // Unhandled 'error' event
^
Error: Cannot find module './client/.index.js' from '/Users/myuser/workspace/myproject'
at …Run Code Online (Sandbox Code Playgroud) 基本上我想设置我的任务,如果我这样做gulp less --watch会看,否则只是做构建.这是我到目前为止:
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var gulpif = require('gulp-if');
var watch = require('gulp-watch');
var cli = require('minimist')(process.argv.slice(2));
gulp.task('less', function () {
return gulp.src(['./client/styles/styles.less', './client/styles/libs.less'])
.pipe(less({ sourceMap: !cli.production }))
.pipe(gulp.dest('./dist/styles'))
.pipe(gulpif(cli.watch, watch()));
});
Run Code Online (Sandbox Code Playgroud)
会发生什么是它仍然执行watch,但不传递任何文件.这也可以防止任务进入process.exit()..
我假设我必须将其包装在某物中,或使用替代方法(不是gulp-if).
这个问题一直困扰着我一段时间,我没有找到一个好的答案(除了"那就是它是如何").
让我给出一些背景代码,以显示我在说什么.
class Note {
private final String name = "Note";
public Note() {
System.out.println(name);
}
// ...
}
class Todo extends Note {
private final String name = "Todo";
public Todo() {
System.out.println(name);
}
// ...
}
// ...
Note note = new Todo(); // case 1
Todo todo = new Todo(); // case 2
Run Code Online (Sandbox Code Playgroud)
那么案例1和案例2如何打印出来:
Note
Todo
Run Code Online (Sandbox Code Playgroud)
这是没有意义的,因为Todo()(构造函数)不调用super()(至少不可见).为什么子类必须调用父默认构造函数,为什么不只需要任何子类来实现构造函数?
我读了几个与此相关的问题,但没有人回答为什么.
编辑:
我想我的例子有点差,但它实际上是Java 7认证问题的衍生物.从答案的集合我现在明白为什么.让我提供一个更好的例子:
public Note {
private String description; …Run Code Online (Sandbox Code Playgroud) 我已经搜索了SO和google,我没有在两个地方声明相同的变量,也没有以奇怪的方式包含某些内容......我知道.插入方法应该工作正常,这是一个预先编写的方法(我想这也可能是错的..大声笑).这是我得到的错误.
错误:
error C2872: 'range_error' : ambiguous symbol
........ while compiling class template member function 'Error_code List<List_entry>::insert(int,const List_entry &)'
Run Code Online (Sandbox Code Playgroud)
对我来说,insert方法看起来没问题,我没有看到与0比较的位置变量或在构造函数中声明为0的count返回range_error的任何问题.
插入方法:
template <class List_entry>
Error_code List<List_entry>::insert(int position, const List_entry &x){
Node<List_entry> *new_node, *following, *preceding;
if(position < 0 || position > count){
return range_error;
}
if(position == 0){
if(count == 0) following = nullptr;
else {
set_position(0);
following = current;
}
preceding = nullptr;
}
else {
set_position(position - 1);
preceding = current;
following = preceding->next;
}
new_node = new Node<List_entry>(x, …Run Code Online (Sandbox Code Playgroud) 结构看起来像这样:
template <class Node_entry>
Node<Node_entry>::Node(Node_entry item, Node *add_on)
{
entry = item;
next = add_on;
}
Run Code Online (Sandbox Code Playgroud)
并且*new_rear指针没有初始化,但是&item填充了用户输入.
Error_code Extended_queue::append(const Queue_entry &item) {
Node<Queue_entry> *new_rear = new Node<Queue_entry>(item);
if(new_rear = 0)
return overflow;
if(rear = 0){
front = new_rear;
rear = new_rear;
}
else {
rear->next = new_rear;
rear = new_rear;
}
return success;
}
Run Code Online (Sandbox Code Playgroud)
在VS2010的本地人中,这个和new_rear都是(!)在下一个和条目中,项目是好的.我该怎么做才能得到这个?
"访问冲突写入位置0x00000010."
寄存器间接和基本加偏移有什么区别,它如何影响您在MIPS架构上编写汇编的方式?我认为这意味着你只能在一条指令中引用寄存器,那个寄存器必须指向更多的指令?
我想阻止按钮点击重新加载页面.点击我只想交换按钮值而不刷新页面.我怎么能这样做?
<button id="4">134</button> // button 1
<button id="5">234</button> // button 2
Run Code Online (Sandbox Code Playgroud)
单击按钮1(ID为"4"的按钮)后,我想要以下结果
// After clicking button 1
<button id="4">234</button> // button 1
<button id="5">134</button> // button 2
Run Code Online (Sandbox Code Playgroud)
如何在不重新加载/刷新html页面的情况下执行此操作.
javascript ×4
c++ ×2
gulp ×2
java ×2
pointers ×2
ambiguous ×1
annotations ×1
architecture ×1
assembly ×1
browserify ×1
build ×1
colon ×1
constructor ×1
eclipse ×1
ember.js ×1
function ×1
gulp-less ×1
gulp-watch ×1
html ×1
mips ×1
oop ×1
struct ×1
subclass ×1
windows-8 ×1
winjs ×1
winrt-xaml ×1