While there is an expectation in open-source projects that the software tweaks of others will be given back to the community working on the software, open source often requires a license as well.

But where software licenses typically forbid touching code or sharing code with anyone, open-source licenses usually insist on sharing. They detail what can and cannot be used by other companies in their products. And they often require people to share their work with other developers.

The idea is that, collectively, people working at many companies or even out of their homes or college dorms can build better technology than what is created behind the closed doors of one corporation.

From the start, this was a trial neither side intended. Oracle first sued Google in 2010, accusing it of patent and copyright violations in Android. The outcome of that case, which was decided in 2012, was largely favorable to Google.

But in 2014, a federal appeals court found that certain parts of Java were protected by copyright, providing Oracle with fresh ammunition. When the Supreme Court refused to hear an appeal of that decision last year, the case was sent back to the lower courts to hear the copyright aspect of the case again.

In this iteration of the courtroom fight, Eric E. Schmidt, executive chairman of Alphabet, Google’s parent company, testified that Sun knew Google was using Java and approved of that use even though Google did not obtain a license. Jonathan Schwartz, who was chief executive of Sun before Oracle bought it, backed up that view, and a blog post he wrote praising Android was a major piece of evidence in the trial.

Oracle provided a series of emails and meeting documents that countered that view, suggesting that Larry Page, a founder of Google and chief executive of Alphabet, had pressed the Android team to develop the product quickly. Mr. Page denied the suggestion on the stand.