Silver: Cannot override final method + Cannot subclass sealed/static class

IDE: Fire
Version: 8.4.96.2033
Target (If relevant): Android
Description:
After upgrading to 2033 build two new error popped which before were non-existent.

The subclass of generic Enumerator type will complain with Cannot subclass sealed/static class while Enumerator<T> is nor sealed non static. Also nextObject() override will complain that I am overriding the final method, while nextObject() is not final.

public class FlatGridBreadthFirstEnumerator<T: PlainGridBreadthFirstEnumeratable>: Enumerator<T> {
      ....

      public override func nextObject() -> T? {
            let entityToReturn: T? = (_nonLazySequenceIteretorIndex < _nonLazyTileSequence.count) ? _nonLazyTileSequence[_nonLazySequenceIteretorIndex] : nil
	    _nonLazySequenceIteretorIndex += 1
	    return entityToReturn
      }
}

Reference: Enumerator

#if COOPER
	import java.util
#elseif ECHOES
	import System.Collections.Generic
#elseif NOUGAT
	import Foundation
#endif

#if NOUGAT
__mapped public class Enumerator<T> => Foundation.NSEnumerator {
	
	public func nextObject() -> T? { return __mapped.nextObject() }
	public var allObjects: Array<T> { return __mapped.allObjects.mutableCopy }
}
#else

public class Enumerator<T> {
	
	public func nextObject() -> T? {
		
		RequiresConcreteImplementation()
	}
}

extension Enumerator {
	public var allObjects: Array<T> {
		var allObjectCollection = [T]()
		
		let element: T?
		while ( (element = self.nextObject()) != nil ){
			allObjectCollection.append(element!)
		}
		
		return allObjectCollection
	}
}

#if COOPER
extension Enumerator: Iterable<T> {
	
	internal class Iterator<T>: java.util.Iterator<T> {
		private let _enumerator: Enumerator<T>
		init(enumerator: Enumerator<T>){
			_enumerator = enumerator
		}
		
		//java.util.Iterator<T>
		public func next() -> T {
			return _enumerator.nextObject()!
		}
		
		public func hasNext() -> Bool {
			return ((_enumerator.nextObject() != nil) ? true : false)
		}
		
		public func remove() {
			_enumerator.remove()
		}
	}
	
	public func iterator() -> java.util.Iterator<T>! {
		return Iterator(enumerator: self)
	}
	
	//for glueing it to java.util.Iterator
	public func remove() {
		RequiresConcreteImplementation()
	}
}
#endif

Hi,

is Enumerator in another library by any chance? Latest Silver has “open” and “public”, you want to use open for things that need overriding in another library:

You guys already update to it? Cool, yes, it is in another library.
Got it. Thanks!

Yep. We try to keep backward compatibility in, but this particular one was breaking.

fileprivate was really breaking for me couple of weeks ago :slight_smile: