这是本节的多页打印视图。 点击此处打印.

返回本页常规视图.

JVM

1 - Maven

test

# org.apache.maven.plugins:maven-surefire-plugin:2.22.0
mvn -Dtest=TestApp1,TestApp2 test
mvn -Dtest=TestApp1#testHello* test
# match pattern 'testHello*' and 'testMagic*' 
mvn -Dtest=TestApp1#testHello*+testMagic* test

2 - OpenJDK

compile openjdk

jdk18 on mac
git clone https://github.com/openjdk/jdk18.git --depth=1
# autoconf=2.71, ccache=4.6.3, freetype=2.12.1
brew install autoconf ccache freetype

bash ./configure --help
# --enable-debug : --with-debug-level=fastdebug --with-debug-level=slowdebug
# --with-jvm-variants=server
# --with-num-cores=8
# --with-memory-size=8192

# MacOS
# configure: error: No xcodebuild tool and no system framework headers found
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
# jdk17+ require xcode itself
bash ./configure --with-debug-level=slowdebug --enable-ccache --disable-warnings-as-errors
make images
./build/macosx-x86_64-normal-server-slowdebug/jdk/bin/java -version
jdk8u
# jdk8u
bash ./configure --with-num-cores=8 --with-debug-level=slowdebug
jdk17 on debian10
# 10.3 is ok
sudo apt install g++-10

# Compile jdk17 on debian 11.2 gcc 10.2
git clone https://github.com/openjdk/jdk17 --depth=1
cd jdk17u

# tools
sudo apt install gcc g++ make autoconf ccache zip 

# Boot JDK
sudo apt install openjdk-17-jdk

# header files
sudo apt install -y libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev
sudo apt install -y libcups2-dev libfontconfig1-dev libasound2-dev

bash ./configure --with-debug-level=slowdebug --enable-ccache
make images

3 - Scala

Scala语法

// import math._ but cos
import math.{cos => _, _}

object HelloWolrd {
    def main(args: Array[String]): Unit = {
        val myVal: String = "Hello World!"
        var myVar: Long = System.currentTimeMillis()
        myVar += 1
        val name = myVal:Object // cast
        println(s"$myVal")
    }
    def patternMatch(x: Any): Any = x match {
        case 1 => 1
        case "five" => 5
        case _ => 0
    }
}
trait Animal {
    final val age = 18
    val color: String
    val kind = "Animal"
    def eq(x: Any): Boolean
    def ne(x: Any): Boolean = !eq(x)
}
class Cat extends Animal {
    override val color = "Yellow"
    override val kind = "Cat"
    def eq(x: Any): Boolean = false
}
class Dog(name: String) extends Animal {
    def this() = this("Dog")
    override val color = "Brown"
    def eq(x: Any): Boolean = true
}
trait Traversable {
    def foreach[U](f: Elem => U): Unit
}

trait Iterable extends Traversable

trait Seq extends Iterable
trait Set extends Iterable
trait Map extends Iterable

import cpllection.JavaConvertions._