Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Путь для исключения формируется даже в том случае, если в блоке try совсем ничего предосудительного. Например, присваивание целочисленной константы в локальную переменную — это две инструкции iconst и istore, ни про одну из них в спецификации не сказано, что они могут сгенерировать исключение.Тут вы не правы. Параграф 2.10 JVMS говорит:
An asynchronous exception, by contrast, can potentially occur at any point in the execution of a program.Таким образом JVM должна быть готова к тому, что во время исполнения любой инструкции может быть выброшено исключение.
An asynchronous exception occurred because:
* The stop method of class Thread or ThreadGroup was invoked, or
* An internal error occurred in the Java Virtual Machine implementation.
Я слышал, что есть заказчики, которые платят за строчку кода.
HelloWriter.java:
public class HelloWriter {
public void doIt () {
System.out.println ("Hello world!");
}
}
Main.java:
public class Main {
public static void main (String[] args) {
HelloWriter writer = new HelloWriter ();
writer.doIt ();
}
}
javac HelloWriter.java Main.java
java Main
using System;
namespace TestConsole
{
public class Program
{
public static void Main(string[] args)
{
int a;
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
try { a = 0; } finally {
}}}}}}}}}}}}
Console.WriteLine(a);
}
// Точка входа для Java
public static void main(string[] args)
{
Main(args);
}
}
}
.class?Class-файл версии 50 и ниже так просто не растаращишь.Там выше был пример с полуторкой. Собственно потому и результат такой.
class X<A, B, C, D, E> { class Y : X<Y, Y, Y, Y, Y> { Y.Y.Y.Y.Y.Y.Y.Y.Y y;} }
A generic type consists of a name followed by a <…>-delimited list of generic parameters, as in C.
Two or more generic types shall not be defined with the same name, but different numbers of generic
parameters, in the same scope. However, to allow such overloading on generic arity at the source
language level, CLS Rule 43 is defined to map generic type names to unique CIL names. That Rule
states that the CLS-compliant name of a type C having one or more generic parameters, shall have a
suffix of the form `n, where n is a decimal integer constant (without leading zeros) representing the
number of generic parameters that C has. For example: the types C, C, and C<K,V> have CLScompliant
names of C, C`1, and C`2<K,V>, respectively. [Note: The names of all standard library
types are CLS-compliant; e.g., System.Collections.Generic.IEnumerable`1. end note]
Как растаращить class-файл