Java: An Operational Java: An Operational Semantics Semantics - - PowerPoint PPT Presentation

java an operational java an operational semantics
SMART_READER_LITE
LIVE PREVIEW

Java: An Operational Java: An Operational Semantics Semantics - - PowerPoint PPT Presentation

Java: An Operational Java: An Operational Semantics Semantics Gaurav S. S. Kc Kc Gaurav B. Eng Eng. Project . Project B. Department of Computing Department of Computing Semantics of Java -- -- why? why? Semantics of Java


slide-1
SLIDE 1

Java: An Operational Java: An Operational Semantics Semantics

Gaurav Gaurav S.

  • S. Kc

Kc B.

  • B. Eng
  • Eng. Project

. Project Department of Computing Department of Computing

slide-2
SLIDE 2

Semantics of Java Semantics of Java --

  • - why?

why?

  • Semantics:

Semantics:

– – Assignment of meanings to programs Assignment of meanings to programs

  • Java:

Java:

– – A simple, object A simple, object-

  • oriented, distributed,
  • riented, distributed,

interpreted, interpreted, robust robust, , secure secure, architecture , architecture neutral, portable, high neutral, portable, high-

  • performance,

performance, multithreaded, and dynamic language. multithreaded, and dynamic language.

slide-3
SLIDE 3

Why? … contd. Why? … contd.

  • Better “mental model” of language

Better “mental model” of language

  • Acceptance

Acceptance

– – reliability reliability – – expected behaviour expected behaviour

  • Java : Security v.s. functionality

Java : Security v.s. functionality

  • Widespread use

Widespread use

  • Reasoning: towards a compromise

Reasoning: towards a compromise

slide-4
SLIDE 4

Project Goals Project Goals

  • Semantics extension

Semantics extension

  • Better understanding of Java

Better understanding of Java

  • Research based

Research based --

  • - no implementation

no implementation

slide-5
SLIDE 5

Break Break-

  • down into parts

down into parts

  • Existing features:

Existing features:

– – inheritance inheritance – – instance variables instance variables – – overloading and overriding

  • verloading and overriding
  • Additions:

Additions:

– – access modifiers access modifiers – – final, static, abstract final, static, abstract – – constructors constructors

slide-6
SLIDE 6

An example in the new syntax An example in the new syntax

abstract abstract class Animal extends Object { class Animal extends Object { int int age; age; Animal Animal() { () { super super();} ();} int getAge int getAge() { ...} } () { ...} } public public final final class Dog extends Animal { class Dog extends Animal { final final int int legs = 4; legs = 4; final final static static boolean boolean hasTail hasTail = yes; = yes; Dog() { Dog() { this this(“ (“Laika Laika”); } ”); } Dog(String s) { Dog(String s) { super(); … } super(); … } int getAge int getAge(String name) { …} } (String name) { …} }

slide-7
SLIDE 7

Access Modifiers Access Modifiers

  • Public

Public

  • Protected

Protected

  • Private

Private

  • [default]

[default]

  • No packages

No packages

  • Accessibility checks

Accessibility checks

Semantics extension ...

slide-8
SLIDE 8

Final and Abstract modifier Final and Abstract modifier

  • Classes

Classes

– – sub sub-

  • classing not permitted

classing not permitted – – instantiating not permitted instantiating not permitted

  • Fields

Fields

– – Constant behaviour? Constant behaviour?

  • Well

Well-

  • formedness

formedness

  • Constructor invocation

Constructor invocation

  • Assignment

Assignment

Semantics extension ...

slide-9
SLIDE 9

Static modifier Static modifier

  • Fields that don’t belong to objects

Fields that don’t belong to objects

  • Class and interface fields

Class and interface fields

  • State extension:

State extension:

– – Class/interface entries Class/interface entries – – References References

  • Runtime checks

Runtime checks

  • Class or interface v.s. object

Class or interface v.s. object

Semantics extension ...

slide-10
SLIDE 10

Constructor Constructor

A A constructor constructor is used in the creation of an is used in the creation of an

  • bject that is an instance of a class.
  • bject that is an instance of a class.

It is the basis with which the run It is the basis with which the run-

  • time

time system allocates space from memory to system allocates space from memory to

  • bjects during execution.
  • bjects during execution.

Instance fields & [inherited] instance fields

Instance fields & [inherited] instance fields

OutOfMemory

OutOfMemory exception exception

Static initialisation

Static initialisation

slide-11
SLIDE 11

Syntax of a Constructor Syntax of a Constructor

  • Explicit constructor

Explicit constructor invocation invocation

– – this(); this();

same class

same class

– – super(); super();

parent class

parent class

static initialisation

static initialisation

  • Statements

Statements

public class public class C C extends extends B { B { int int x = 5; x = 5; public public C ( C (int int n) { n) { this this( (true true); ); print(n); print(n); } } private private C ( C (boolean boolean b) { b) { super super(); (); if if (b) … (b) … } } } }

slide-12
SLIDE 12

[boolean] C(true), σ [] B(); x=5; if (b) …, σ

Constructor Constructor execution execution

new C(true);

slide-13
SLIDE 13

Other research work on Java Other research work on Java

  • Within the Department of Computing:

Within the Department of Computing:

– – Exceptions Exceptions SLURP SLURP@ @DoC DoC – – Concurrency Concurrency SLURP SLURP@ @DoC DoC – – Binary Compatibility Binary Compatibility SLURP SLURP@ @DoC DoC

  • In other research institutions:

In other research institutions:

– – Generics Generics PLT PLT@Rice @Rice – – Security Issues Security Issues SIP SIP@Princeton @Princeton

slide-14
SLIDE 14

Other research, … Other research, … contd contd. .

  • A comparison perhaps?

A comparison perhaps?

– – Different aspects of Java Different aspects of Java – – Post Post-

  • grad & post

grad & post-

  • doc work

doc work

slide-15
SLIDE 15

Conclusions Conclusions

  • Boring? Certainly not!

Boring? Certainly not!

  • Acquired skills

Acquired skills

  • Taste of pure research

Taste of pure research

  • Lots of non

Lots of non-

  • trivial work

trivial work

  • State of the art technology

State of the art technology

  • Continued research in Java Semantics

Continued research in Java Semantics

  • Improved know

Improved know-

  • how of the Java system

how of the Java system

slide-16
SLIDE 16

Acknowledgements Acknowledgements

  • Krysia Broda

Krysia Broda

  • Sophia

Sophia Drossopoulou Drossopoulou

  • Susan

Susan Eisenbach Eisenbach

  • Tanya

Tanya Valkevych Valkevych