我最近从eclipse切换到IntelliJ.Eclipse的调试启动程序用于在保存类时立即重新加载应用程序.IntelliJ需要超过10秒来重新加载更改的类,这可能不是很多,但它很烦人,因为我经常使用它.
如何使IntelliJ重新加载更改类更快?
我在xcode 9.3和xcode 10 beta 3游乐场中运行此代码
import Foundation
public protocol EnumCollection: Hashable {
static func cases() -> AnySequence<Self>
}
public extension EnumCollection {
public static func cases() -> AnySequence<Self> {
return AnySequence { () -> AnyIterator<Self> in
var raw = 0
return AnyIterator {
let current: Self = withUnsafePointer(to: &raw) { $0.withMemoryRebound(to: self, capacity: 1) { $0.pointee } }
guard current.hashValue == raw else {
return nil
}
raw += 1
return current
}
}
}
}
enum NumberEnum: EnumCollection{
case …Run Code Online (Sandbox Code Playgroud) 这可能看起来像一个重复的问题,但事实并非如此!
我在RecyclerView上遇到了这种罕见的崩溃
java.lang.IndexOutOfBoundsException:
Inconsistency detected.
Invalid item position 1(offset:1).state:4 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5014).
Run Code Online (Sandbox Code Playgroud)
我很确定在数据更改后我没有错过任何关于我的适配器的通知!
除了崩溃之外,我无法理解的一件事是我使用的是android.support.v7.widget.RecyclerView,崩溃是在那个java文件中的第5014行
来自RecyclerView.java的代码我的崩溃发生了
if (offsetPosition < 0 || offsetPosition >= mAdapter.getItemCount()) {
throw new IndexOutOfBoundsException("Inconsistency detected. Invalid item "
+ "position " + position + "(offset:" + offsetPosition + ")."
+ "state:" + mState.getItemCount());
}
Run Code Online (Sandbox Code Playgroud)
所以这也要崩溃
offsetPosition < 0
Run Code Online (Sandbox Code Playgroud)
要么
offsetPosition >= mAdapter.getItemCount()
Run Code Online (Sandbox Code Playgroud)
从崩溃日志中可以清楚地看出,我的offsetPosition是1
offsetPosition >= mAdapter.getItemCount()
Run Code Online (Sandbox Code Playgroud)
一定是真的!! 但在我的适配器中,我实现了像这样的getItemCount
@Override
public int getItemCount() {
return list.size() + 3;
}
Run Code Online (Sandbox Code Playgroud)
所以至少getItemCount应该返回3所以第二个语句也不可能是真的.
完整的崩溃日志
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 1(offset:1).state:4
at …Run Code Online (Sandbox Code Playgroud)